compose: Cannot open self /usr/bin/docker-compose or archive /usr/bin/docker-compose.pkg

I installed docker-compose on my server I reconnect later it said :

Cannot open self /usr/bin/docker-compose or archive /usr/bin/docker-compose.pkg

I have to reinstall it all the time 😕

Thanks for your help!

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 22
  • Comments: 67

Commits related to this issue

Most upvoted comments

I had same problem, it was because of permissions. This helped: sudo chmod a+rx /usr/local/bin/docker-compose

Docker-compose requires not only x permission, but also r permission, so as @hajaalin pointed out sudo chmod +rx /usr/local/bin/docker-compose solves the issue. (Issue can be closed)

same problem but I could not find a certain useful answer to solve it

#docker-compose Cannot open self /usr/local/bin/docker-compose or archive /usr/local/bin/docker-compose.pkg

yeah, i have solved this problem now! you can do like this.

do not use the command line curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-uname -s-uname -m > /usr/local/bin/docker-compose to download, maybe this makes it too slow to download.

choose the way of downloading the file , visit this https://github.com/docker/compose/releases website and choose file to download docker-compose-Linux-x86_64 7.67 MB docker-compose-Windows-x86_64.exe 5.97 MB then rename as docker-compose and copy into /usr/local/bin/

that’s OK.

now you can use docker-compose --version to test whether your docker-compose is installed

Same problem, reason is curl download was incomplete. And no error output!!!

sudo curl -v -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose adding the -v option is the key!

Possibly incomplete download or corrupt binary. I reinstalled and everything worked fine.

This is due to prelinking stripping of the zip file appended to the end of the file.

To reproduce run prelink on docker-compose.

This is done daily on OEL6 in /etc/cron.daily/prelink

The fix for this is to get pyinstaller to put the data in a elf section so it doesn’t get thrown away

or disable prelinking of docker-compose

sudo curl -L “https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)” -o /usr/local/bin/docker-compose

It solves the problem for me.

Thank you. It works.

This is still broken on Ubuntu 16.04.

$ uname -a
Linux me 4.4.0-34-generic #53-Ubuntu SMP Wed Jul 27 16:06:39 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.1 LTS
Release:    16.04
Codename:   xenial
$ curl -L https://github.com/docker/compose/releases/download/1.8.0/docker-compose-`uname -s`-`uname -m` > docker-compose
$ ll docker-compose
-rw-rw-r-- 1 me me 7970402 Sep  5 10:37 docker-compose
$ sudo mv docker-compose /usr/local/bin/docker-compose
$ chmod 755 /usr/local/bin/docker-compose
$ ll /usr/local/bin/docker-compose
-rwxr-xr-x 1 me me 7970402 Sep  5 10:37 /usr/local/bin/docker-compose*
$ docker-compose
Cannot open self /usr/local/bin/docker-compose or archive /usr/local/bin/docker-compose.pkg

Installing with sudo pip install docker-compose works.

Maybe you should drop the curl installation and require pip. Alternatively, advise to use pip as the preferred method and move curl to the alternative installation methods, with a link to this issue. Both solutions are going to save time to many people.

Just in case it would need a writable /usr/local/bin similarly to what you suggest to do to make the download easier, that’s against any security guideline. I didn’t even attempt it.

Well, I had the same issue on an other executable built with pyinstaller. I managed to solve it by blacklisting the binarie from prelink: add /etc/prelink.d/docker-compose:

-b /usr/bin/docker-compose

To be sure it works call prelink --all

I fixed it.

It is because my desk is full, so I deleted all of images and containers by:

docker rm $(docker ps -aq)
docker rmi $(docker images -q)

sudo curl -L “https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)” -o /usr/local/bin/docker-compose

It solves the problem for me.

This problem was solved, I did nothing but download the “docker-compose-Linux-x86_64” file again. The network sucks!

Ran into this while packaging docker-compose-1.5.2 as an RPM for CentOS 6. Turns out the rpmbuild command has a default strip step at __os_install_post. I “fixed” it by adding this line at the top of my RPM spec:

%global __os_install_post %{nil}

You can find a little more info on RPM stripping - and other ways to disable it - at http://livecipher.blogspot.com/2012/06/disable-binary-stripping-in-rpmbuild.html

The curl instructions are for the pyinstaller version.

It sounds like the download was incomplete, since the file size is wrong?