Docker-compose command not found

Hi ,

I followed as mentioned in video , but i am getting command not found with docker-compose 

[user@anvesh12031 Dockerfiles]$ cat docker-compose.yml

version: '3'

services:

apiweb1:

image: myhttpd:v1

build: .

ports:

- "81:80"

apiweb2:

image: myhttpd:v1

ports:

- "82:80"

loadbalance:

image: nginx:latest

ports:

- "80:80"

[user@anvesh12031 Dockerfiles]$ docker-compose up -d

-bash: docker-compose: command not found

[user@anvesh12031 Dockerfiles]$ ll

total 8

-rwxr-xr-x. 1 user user 222 Jan 6 21:23 docker-compose.yml

-rwxr-xr-x. 1 user user 200 Jan 5 16:57 Dockerfile

[user@anvesh12031 Dockerfiles]$ docker-compse.yml up -d

-bash: docker-compse.yml: command not found

[user@anvesh12031 Dockerfiles]$ docker-

docker-init docker-proxy


  • post-author-pic
    Terrence C
    01-06-2019

    Looks like Docker Compose is not installed (or at least, not in the path). If you execute 'which docker-compose', do you get a path/location back for the command? Also, you cannot execute the yaml file itself, I see you also try to do a 'docker-compose.yml up -d', the yaml file won't execute, it simply contains the tasks you want Docker Compose to do.

  • post-author-pic
    Anvesh M
    01-07-2019

    [user@anvesh12031 ~]$ which docker-compose

    /usr/bin/which: no docker-compose in (/usr/local/rvm/gems/ruby-2.4.1/bin:/usr/local/rvm/gems/ruby-2.4.1@global/bin:/usr/local/rvm/rubies/ruby-2.4.1/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/usr/local/rvm/bin:/home/user/.local/bin:/home/user/bin)


    [user@anvesh12031 ~]$ pip list | grep docker-compose

    [user@anvesh12031 ~]$ yum list | grep docker-compose

    docker-compose.noarch 1.18.0-2.el7 epel


    [user@anvesh12031 ~]$ sudo pip install docker-compose

    [sudo] password for user:

    Collecting docker-compose

    Using cached https://files.pythonhosted.org/packages/1e/6c/bf9879305530c4b765ef4eb3be76202788ca1037aec74d2c0ec73191d467/docker_compose-1.23.2-py2.py3-none-any.whl

    Requirement already satisfied: PyYAML<4,>=3.10 in /usr/lib64/python2.7/site-packages (from docker-compose) (3.10)

    Collecting docker<4.0,>=3.6.0 (from docker-compose)

    Using cached https://files.pythonhosted.org/packages/e1/58/938fbc7acd98302ca4872f5eab8ab811498e342ab5aec0c1609f22e0aeda/docker-3.6.0-py2.py3-none-any.whl

    Requirement already satisfied: backports.ssl-match-hostname>=3.5; python_version < "3.5" in /usr/lib/python2.7/site-packages (from docker-compose) (3.5.0.1)

    Collecting requests!=2.11.0,!=2.12.2,!=2.18.0,<2.21,>=2.6.1 (from docker-compose)

    Using cached https://files.pythonhosted.org/packages/ff/17/5cbb026005115301a8fb2f9b0e3e8d32313142fe8b617070e7baad20554f/requests-2.20.1-py2.py3-none-an

    .1)

    y.whl

    Requirement already satisfied: six<2,>=1.3.0 in /usr/lib/python2.7/site-packages (from docker-compose) (1.9.0)

    Requirement already satisfied: enum34<2,>=1.0.4; python_version < "3.4" in /usr/lib/python2.7/site-packages (from docker-compose) (1.0.4)

    Collecting texttable<0.10,>=0.9.0 (from docker-compose)

    Using cached https://files.pythonhosted.org/packages/02/e1/2565e6b842de7945af0555167d33acfc8a615584ef7abd30d1eae00a4d80/texttable-0.9.1.tar.gz

    Collecting dockerpty<0.5,>=0.4.1 (from docker-compose)

    Using cached https://files.pythonhosted.org/packages/8d/ee/e9ecce4c32204a6738e0a5d5883d3413794d7498fe8b06f44becc028d3ba/dockerpty-0.4.1.tar.gz

    Requirement already satisfied: ipaddress>=1.0.16; python_version < "3.3" in /usr/lib/python2.7/site-packages (from docker-compose) (1.0.16)

    Requirement already satisfied: websocket-client<1.0,>=0.32.0 in /usr/lib/python2.7/site-packages (from docker-compose) (0.54.0)

    Collecting docopt<0.7,>=0.6.1 (from docker-compose)

    Using cached https://files.pythonhosted.org/packages/a2/55/8f8cab2afd404cf578136ef2cc5dfb50baa1761b68c9da1fb1e4eed343c9/docopt-0.6.2.tar.gz

    Collecting jsonschema<3,>=2.5.1 (from docker-compose)

    Using cached https://files.pythonhosted.org/packages/77/de/47e35a97b2b05c2fadbec67d44cfcdcd09b8086951b331d82de90d2912da/jsonschema-2.6.0-py2.py3-none-a

    ny.whl

    Collecting cached-property<2,>=1.2.0 (from docker-compose)

    Using cached https://files.pythonhosted.org/packages/3b/86/85c1be2e8db9e13ef9a350aecd6dea292bd612fa288c2f40d035bb750ded/cached_property-1.5.1-py2.py3-n

    one-any.whl

    Requirement already satisfied: docker-pycreds>=0.3.0 in /usr/lib/python2.7/site-packages (from docker<4.0,>=3.6.0->docker-compose) (0.4.0)

    Requirement already satisfied: idna<2.8,>=2.5 in /usr/lib/python2.7/site-packages (from requests!=2.11.0,!=2.12.2,!=2.18.0,<2.21,>=2.6.1->docker-compose)

    (2.7)

    Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/lib/python2.7/site-packages (from requests!=2.11.0,!=2.12.2,!=2.18.0,<2.21,>=2.6.1->docker-c

    ompose) (3.0.4)

    Requirement already satisfied: urllib3<1.25,>=1.21.1 in /usr/lib/python2.7/site-packages (from requests!=2.11.0,!=2.12.2,!=2.18.0,<2.21,>=2.6.1->docker-c

    ompose) (1.24.1)

    Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python2.7/site-packages (from requests!=2.11.0,!=2.12.2,!=2.18.0,<2.21,>=2.6.1->docker-comp

    ose) (2018.11.29)

    Collecting functools32; python_version == "2.7" (from jsonschema<3,>=2.5.1->docker-compose)

    Using cached https://files.pythonhosted.org/packages/c5/60/6ac26ad05857c601308d8fb9e87fa36d0ebf889423f47c3502ef034365db/functools32-3.2.3-2.tar.gz

    Installing collected packages: requests, docker, texttable, dockerpty, docopt, functools32, jsonschema, cached-property, docker-compose

    Found existing installation: requests 2.6.0

    Cannot uninstall 'requests'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to onl

    y a partial uninstall.

  • post-author-pic
    Terrence C
    01-07-2019

    Sometimes relying on Python to manage or know about other dependencies can cause confusion. Try installing directly from Docker using the instructions on their site, you can find that information here (you download and install a pre-written shell script from Docker).

Looking For Team Training?

Learn More