compose icon indicating copy to clipboard operation
compose copied to clipboard

Can't install in Ubuntu 16.04

Open serandel opened this issue 10 years ago • 25 comments

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.

serandel avatar Apr 22 '16 11:04 serandel

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

shin- avatar Apr 22 '16 23:04 shin-

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.

serandel avatar Apr 23 '16 10:04 serandel

This is my PATH:

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

serandel avatar Apr 29 '16 08:04 serandel

Have you not set an "alias" for example ?

What says "which docker-compose" ?

metal3d avatar Apr 29 '16 12:04 metal3d

And the output of "alias" too

metal3d avatar Apr 29 '16 12:04 metal3d

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

serandel avatar May 03 '16 07:05 serandel

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.

metal3d avatar May 03 '16 12:05 metal3d

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

serandel avatar May 03 '16 13:05 serandel

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/

metal3d avatar May 03 '16 13:05 metal3d

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.

metal3d avatar May 03 '16 13:05 metal3d

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

alhexanderad avatar Oct 02 '16 18:10 alhexanderad

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

dnoliver avatar Apr 12 '17 13:04 dnoliver

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

pablorts avatar May 16 '17 11:05 pablorts

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.

metal3d avatar May 16 '17 15:05 metal3d

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 !

fluagen avatar Jun 26 '17 09:06 fluagen

@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.

schulzp avatar Aug 09 '17 12:08 schulzp

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

ghost avatar Mar 02 '18 21:03 ghost

@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.

Groostav avatar Mar 11 '18 20:03 Groostav

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

champi64 avatar Apr 13 '18 14:04 champi64