compose: Can't install in Ubuntu 16.04

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.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 14
  • Comments: 25

Most upvoted comments

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.

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

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??

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 !

I could install docker-compose: $ sudo pip install -U 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/