Compose: Can't install in Ubuntu 16.04

Created on 22 Apr 2016  Â·  24Comments  Â·  Source: docker/compose

I just tried to install Docker Compose in a brand new VirtualBox Ubuntu 16.04 installation, following the instructions:

curl -L https://github.com/docker/compose/releases/download/1.7.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

But now, when I try to use it, this happens:

$ docker-compose version
bash: /usr/bin/docker-compose: No existe el archivo o el directorio

(It's a "file not found" error in Spanish. :)

Symlinking /usr/bin/docker-compose -> /usr/local/bin/docker-compose works OK.

arepackaging

Most helpful comment

My god... Your problem is weird.

Have you made something with update-alternative ? Can you post the command output of :

ls -la /usr/bin/docker-compose
ls -la /usr/local/bin/docker-compose

I'm wondering if there is a broken "link"

Anyway, to resolve the problem, you may use:

ln -sf /usr/local/bin/docker-compose /usr/bin/docker-compose

BTW: I never install docker-compose in /usr/local/bin, I'm using "pip install --user docker-compose" to install it in "~/.local/bin" and to be able to easily upgrade or downgrade version.

All 24 comments

Interesting. Is /usr/local/bin/ in your $PATH?

I've tried in another new installation and it works OK. I just installed via apt git and then docker.io. The only differences I can think of is that this new VM has Ubuntu in English and that in the first one, I first installed docker-compose from Canonical, saw that the version was too old for version 2 config files, removed it with apt-get and then installed latest docker-compose from here.

I suspect apt-get is the culprit...

Will check $PATH when I return to the office next Friday.

This is my PATH:

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

Have you not set an "alias" for example ?

What says "which docker-compose" ?

And the output of "alias" too

ldasdq@ubuntu-16_10-vm:~$ alias

alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
ldasdq@ubuntu-16_10-vm:~$ which docker-compose

/usr/local/bin/docker-compose

My god... Your problem is weird.

Have you made something with update-alternative ? Can you post the command output of :

ls -la /usr/bin/docker-compose
ls -la /usr/local/bin/docker-compose

I'm wondering if there is a broken "link"

Anyway, to resolve the problem, you may use:

ln -sf /usr/local/bin/docker-compose /usr/bin/docker-compose

BTW: I never install docker-compose in /usr/local/bin, I'm using "pip install --user docker-compose" to install it in "~/.local/bin" and to be able to easily upgrade or downgrade version.

Nope, I did no customizing. Brand new Ubuntu just for Docker, apt-get install -y docker.io docker-compose, then apt-get uninstall docker-compose and install it again from here. :/ I can try to reproduce the issue in another VM if it's helpful.

/usr/local/bin/docker-compose didn't exist, I already made the symlink and it works OK from then on.

ls -la /usr/bin/docker-compose 

lrwxrwxrwx 1 root root 29 abr 22 13:25 /usr/bin/docker-compose -> /usr/local/bin/docker-compose

OK, that's the problem.
You've got a link from /usr/bin/docker-compose to /usr/local/bin/docker-compose
But /usr/local/bin/docker-compose didn't exist.

The problem was your installation command

curl -L https://github.com/docker/compose/releases/download/1.7.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose

It hasn't worked, maybe because you did it as user and not as root. So, the file were not created.

If you installed docker-compose from "apt-get" command, you've probably broken docker-compose installation. I recommend to use commands from docker installation documentation page.
https://docs.docker.com/engine/installation/linux/ubuntulinux/

And same for docker-compose if you don't want to use "python pip" command to install it:
https://docs.docker.com/compose/install/

Precision:
"Run sudo -i, ..." as explained in the installation manual page before to run the "curl" command
"then the two commands below, then exit." etc.

I could install docker-compose:
$ sudo pip install -U docker-compose

Having the same issue.

First, I run

sudo apt install docker-compose

and it installed docker-compose into /usr/bin/docker-compose. Then I read the documentation (too late) here https://github.com/docker/compose/releases and try to uninstall docker-compose and reinstall it again.

``` $ sudo apt remove docker-compose # OK $ sudo -i $ curl -L https://github.com/docker/compose/releases/download/1.12.0/docker-compose-uname -s-uname -m` > /usr/local/bin/docker-compose
$ chmod +x /usr/local/bin/docker-compose
$ exit # to exit root shell

$ whereis docker-compose
docker-compose: /usr/local/bin/docker-compose

$ docker-compose --version
-bash: /usr/bin/docker-compose: No such file or directory

$ /usr/local/bin/docker-compose --version
docker-compose version 1.12.0, build

For some reason, it is using previous installed docker-compose!

$ ln -sf /usr/local/bin/docker-compose /usr/bin/docker-compose
$ docker-compose --version
docker-compose version 1.12.0, build b31ff33

````

But why it try to use old installed compose??

Hi,
I have the same problem as @serandel.
Please, how did you solve it?

I tried with the command @metal3d said:
ln -sf /usr/local/bin/docker-compose /usr/bin/docker-compose

But I still get:
/usr/local/bin/docker-compose: line 1: Not: orden no encontrada

Here is the output:
...-VM:/usr/local/bin$ ls -la /usr/bin/docker-compose
lrwxrwxrwx 1 root root 29 may 16 13:24 /usr/bin/docker-compose -> /usr/local/bin/docker-compose
...-VM:/usr/local/bin$ ls -la /usr/local/bin/docker-compose
-rwxr-xr-x 1 root root 9 may 16 13:07 /usr/local/bin/docker-compose

Any suggestion please? @serandel or @metal3d

The only way I now use is pip install. Remove your docker-compose installed in /usr/local and /usr/bin... apt remove... And use:

pip install --user docker-compose

Add your .local/bin in your PATH and try docker-compose​ like that.

first remove old version config

sudo apt-get remove --purge docker-compose
sudo apt-get autoremove 

then

$ docker-compose --version
docker-compose version 1.14.0, build c7bdf9e

now, it's ok !

@serandel I ran into the same issue as you. Pleas look at the file contents you downloaded, e.g. cat /usr/local/bin/docker-compose. Are the contents of that file your Spanish 'file not found'? If so, make sure you use a proper download link. The one linked in the docs uses a placeholder $dockerComposeVersion which has to be replaced with the latest version, see github release.

Happened to me when I first installed docker-compose using apt install

@dmsergeevp44 same, I ran into this problem using apt-get.

after messing around with this for quite some time, my suggestion is:

pip install docker-compose
sudo apt-get install docker-ce #as per https://docs.docker.com/install/linux/docker-ce/ubuntu/#set-up-the-repository

this got me on the latest version of docker-compose and docker.

I know mixing and matching package managers isnt a good idea, but pip doesnt seem to put docker on my path and apt-get has an ancient version of docker-compose.

I was going crazy with this problem, I solved it with:

hash docker-compose

Basically you executed docker-compose once, bash found it on /usr/bin/ and kept that location stored so it wouldn't have to search for it again, so when you executed docker-compose again bash just tried to get it from where it found it last. Then you deleted it with apt-get remove and installed it with curl on another location. Hash tells bash to search for it again instead of looking for it where it found it previously.

BTW copying /usr/local/bin/docker-compose to /usr/bin/docker-compose also works, but I really wanted to know why was it being searched in /usr/bin

Explanation is here https://unix.stackexchange.com/questions/82991/bash-is-not-finding-a-program-even-though-its-on-my-path

Perfect solution @metal3d :)

My problem started when I installed one version, uninstalling it and installing another version. I had to close my terminal and opened it back up and it was back to normal

@champi64
I really want to give you an applaus. I had exactly same situation what you've said.
First, I installed docker-compose using apt-get, after that, I want to upgrade my docker-compose version so I followed docker-compose document to install.
But I faced same problem and then I solved by making new symbolic link in /usr/bin to /usr/local/bin/docker-compose.
I'm very very thanks to all you guys :)

I believe that the problem is the version. In my case work it with:

$ sudo curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-uname -s-uname -m -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose
$ docker-compose --version

I hope that help them !!!

Was this page helpful?
0 / 5 - 0 ratings