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!
:+1: I'm experiencing this too... not sure what extra info would be useful to help debug
how have you installed it? what operating system are you using? what's the output of which docker-compose
?
I've installed via the curl + chmod technique and I'm on ubuntu 14.10 (utopic). And output as requested...
pmehta@phaze:~$ which docker-compose
/usr/local/bin/docker-compose
I've installed docker-compose
with curl
and chmod
method too on a CentOS 7.
$ which docker-compose [19:24:40]
/usr/local/bin/docker-compose
does it work when you install compose with pip?
I had same problem, it was because of permissions. This helped:
sudo chmod a+rx /usr/local/bin/docker-compose
@hajaalin that seems odd. which OS is that? how did you install it?
@jasherai we never had problem with an installation via pip
on Ubuntu. and also python setup.py develop
@funkyfuture I installed with curl
and chmod
method. This is Ubuntu 14.04.2, but not fully standard, the distro is maintained by our university. I don't know if there is some tweak that affects default file permissions, for example.
@funkyfuture I've been running the pip version of the install since your suggestion and it has been stable since. This seems specific to the curl method. I haven't tried the altered permissions that @hajaalin suggested so can't give feedback on that.
Same problem here
-bash-4.1$ docker-compose -p docker ps
Couldn't connect to Docker daemon at http+unix://var/run/docker.sock - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
-bash-4.1$ sudo docker-compose -p docker ps
Cannot open self /usr/bin/docker-compose or archive /usr/bin/docker-compose.pkg
-bash-4.1$ sudo docker-compose -p docker ps
Cannot open self /usr/bin/docker-compose or archive /usr/bin/docker-compose.pkg
-bash-4.1$ which docker-compose
/usr/local/bin/docker-compose
-bash-4.1$ sudo which docker-compose
/usr/bin/docker-compose
-bash-4.1$
-bash-4.1$
-bash-4.1$ sudo cp /usr/local/bin/docker-compose /usr/bin/docker-compose
-bash-4.1$ sudo docker-compose -p docker ps
Name Command State Ports
----------------------------------------------------------------------------------------------------------------
I have the same problem as well. I'm on Mac OSX.
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)
Agree with @frol and @hajaalin -- adding read permission fixed the issue for me. Perhaps the documentation should be updated (https://docs.docker.com/compose/install/#install-compose) and this issue closed.
I still have the issue, inspite of giving the read permission : chmod +rx /usr/bin/docker-compose
This doesn't solve the issue on OEL-6.5 (& higher) OS.
I'm experiencing the same issue on Centos 6.5...In my case the issue is worse because it doesn't consistently happens...meaning I usually can run docker-compose <command>
several times and 1/10 times it fails...The only way to fix it is by downloading the script again using curl.
+1 for this issue.
I found the binary file has been changed(version 1.3.1)
# ls -l /usr/bin/docker-compose
-rwxr-xr-x 1 root root 151325 Jun 26 09:37 /usr/bin/docker-compose
The correct file is:
# ls -l docker-compose-1.3.1
-rw-r--r-- 1 root root 8159297 Jun 23 09:28 docker-compose-1.3.1
I'm experiencing the same issue on Ubuntu 14.04.
~ % uname -a
Linux i 3.13.0-57-lowlatency #95-Ubuntu SMP PREEMPT Fri Jun 19 09:45:24 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
ls -l /usr/local/bin/docker-compose
-rwxr-xr-x 1 root root 6206256 7月 13 14:48 /usr/local/bin/docker-compose
I fixed this by downloading file from browser.
It just works.
Same problem here. I need to reinstall docker-compose every time I reboot my server.
bash-4.1# docker-compose down
Cannot open self /usr/bin/docker-compose or archive /usr/bin/docker-compose.pkg
docker version
Client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d
OS/Arch (client): linux/amd64
Server version: 1.7.1
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 786b29d
OS/Arch (server): linux/amd64
docker info
Containers: 16
Images: 94
Storage Driver: devicemapper
Pool Name: docker-253:2-132569-pool
Pool Blocksize: 65.54 kB
Backing Filesystem: extfs
Data file: /dev/loop0
Metadata file: /dev/loop1
Data Space Used: 8.098 GB
Data Space Total: 107.4 GB
Data Space Available: 1.445 GB
Metadata Space Used: 10.23 MB
Metadata Space Total: 2.147 GB
Metadata Space Available: 1.445 GB
Udev Sync Supported: true
Deferred Removal Enabled: false
Data loop file: /var/lib/docker/devicemapper/devicemapper/data
Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
Library Version: 1.02.89-RHEL6 (2014-09-01)
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 2.6.32-504.23.4.el6.x86_64
Operating System: <unknown>
CPUs: 4
Total Memory: 7.688 GiB
Name: docker-1.dev.infra
ID: Q7PJ:HLWI:OVH5:HC4B:YFM2:WTE2:HDI5:RVMQ:7CC5:PH6A:TGS5:7L76
Nothing in the docker-compose
binary would cause its permissions to be changed. Is something else on your system messing with the permissions of files in /usr/local/bin
? I'm not familiar enough with Linux to know if this is a normal thing for distros to do.
This is pretty weird.
It seems that some process should be changing the permissions. What I end up doing was to set the immutable bit using chattr
so I did: chattr +i docker-compose
and the prevented the issue from happening again.
remember removing the bit using chattr -i docker-compose
if you need to update the binary again.
Anyone experiencing this issue, please tell us:
ls -l /usr/local/bin/docker-compose
immediately after following the install instructionsls -l /usr/local/bin/docker-compose
immediately after getting the Cannot open self
errorHi @aanand, yesterday I tried to reboot my server but the problem didn't occur.
Today it happened again:
bash-4.1# uname -a
Linux docker-1.dev.infra 2.6.32-504.23.4.el6.x86_64 #1 SMP Tue Jun 9 20:57:37 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
bash-4.1# ls -l /usr/local/bin/docker-compose
-rwxr-xr-x 1 root root 8182592 Aug 3 09:08 /usr/local/bin/docker-compose
bash-4.1#
bash-4.1#
bash-4.1# docker-compose -p myproject up -d
Cannot open self /usr/bin/docker-compose or archive /usr/bin/docker-compose.pkg
bash-4.1#
bash-4.1#
bash-4.1# export HTTPS_PROXY=http://proxy-1.dev.infra:3128/
bash-4.1# curl -L https://github.com/docker/compose/releases/download/1.3.3/docker-compose-`uname -s`-`uname -m` > /usr//bin/docker-compose
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 7990k 100 7990k 0 0 1450k 0 0:00:05 0:00:05 --:--:-- 2023k
bash-4.1# docker-compose -p myproject up -d
Creating myproject_mongodb_1...
Creating myproject_sga_1...
Creating myproject_oiapi_1...
Creating myproject_couchbase_1...
Creating myproject_oiauth_1...
Creating myproject_sac_1...
Creating myproject_activemq_1...
Creating myproject_oisender_1...
bash-4.1# ls -l /usr/local/bin/docker-compose
-rwxr-xr-x 1 root root 8182592 Aug 3 09:08 /usr/local/bin/docker-compose
We use Centos6. It could be the problem?
@wrenzi Your curl
line looks strange:
bash-4.1# curl -L https://github.com/docker/compose/releases/download/1.3.3/docker-compose-`uname -s`-`uname -m` > /usr//bin/docker-compose
Looks like you downloaded it to /usr//bin/docker-compose
? As you can see from the output of ls -l
, the modification date of /usr/local/bin/docker-compose
hasn't changed: it's "Aug 3 09:08" both before and after you ran curl
.
Can you check the value of your PATH
variable and the output of which docker-compose
?
@aanand, you are right. I changed it because the /usr/local/bin/ was not in my $PATH (now it is)
I removed the installation and I installed it again in the default path:
bash-4.1# curl -L https://github.com/docker/compose/releases/download/1.3.3/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 7990k 100 7990k 0 0 1535k 0 0:00:05 0:00:05 --:--:-- 2062k
bash-4.1#
bash-4.1# chmod +x /usr/local/bin/docker-compose
bash-4.1#
bash-4.1# which docker-compose
/usr/local/bin/docker-compose
bash-4.1#
bash-4.1# ls -l /usr/local/bin/docker-compose
-rwxr-xr-x 1 root root 8182592 Aug 4 09:01 /usr/local/bin/docker-compose
If the problem occurs again I'll write here. Thank you very much.
To anyone else experiencing the issue:
docker-compose
to?echo $PATH
and which docker-compose
after it runs successfully?echo $PATH
and which docker-compose
after you get the error?This might be an issue with improperly configured PATH
variables.
Where are you installing docker-compose to?
/usr/bin/docker-compose
What's the output of echo $PATH and which docker-compose after it runs successfully?
echo $PATH
/usr/lib64/qt-3.3/bin:/usr/local/rvm/bin:/usr/local/subversion/bin:/usr/local/mysql/bin:/usr/local/xtrabackup/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
which docker-compose
/usr/bin/docker-compose
docker-compose -v
docker-compose version: 1.3.3
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013
What's the output of echo $PATH and which docker-compose after you get the error?
echo $PATH
/usr/lib64/qt-3.3/bin:/usr/local/rvm/bin:/usr/local/subversion/bin:/usr/local/mysql/bin:/usr/local/xtrabackup/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
which docker-compose
/usr/bin/docker-compose
/usr/bin/docker-compose -v
Cannot open self /usr/bin/docker-compose or archive /usr/bin/docker-compose.pkg
@lostsnow
/usr/bin
and not /usr/local/bin
?ls -l /usr/bin/docker-compose
after running successfully?ls -l /usr/bin/docker-compose
after getting the error?@aanand
I just put it here
ls -l /usr/bin/docker-compose
-rwxr-xr-x 1 root root 8182592 Jul 31 16:35 /usr/bin/docker-compose
- What's the output of ls -l /usr/bin/docker-compose after getting the error?
ls -l /usr/bin/docker-compose
-rwxr-xr-x 1 root root 151325 Jul 28 09:59 /usr/bin/docker-compose
The file has been changed, but I do not know why
OK, then something on your system is changing the file. Nothing in Compose or the set of Docker tools would do that. Perhaps something that runs when you start a shell, or when you log in.
I've been doing some digging and have a theory.
To those that are experiencing this issue, can you verify that your system allows execution of files in /tmp
?
A quick test...
touch /tmp/test.sh
vi /tmp/test.sh
#!/bin/bash
echo foo
chmod +x /tmp/test.sh
sh /tmp/test.sh
Looks like the way PyInstaller handles one-file executables is that it expands them in to /tmp
and executes from there. In systems where this is restricted this type of executable won't work.
The workaround is to install using pip
@dave-tucker This would also explain https://github.com/docker/compose/issues/1339
Possibly incomplete download or corrupt binary. I reinstalled and everything worked fine.
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
@davinci1976, you are right. Preventing prelinking fixes this issue. Thanks for bringing this up.
We've updated pyinstaller which may fix this issue. You can try it out by downloading a master build from https://dl.bintray.com/docker-compose/master/
The fix should also be in the 1.5.0 release.
Please let us know if the upgade fixed the issue. Thanks!
Happened again to us using Docker compose version 1.6.0rc1 on RHEL release 6.6.
We installed docker-compose via curl as described here. (i.e. not pyInstaller)
bash-4.1$ docker-compose up -d
Cannot open self /usr/bin/docker-compose or archive /usr/bin/docker-compose.pkg
Compose version: 1.6.0rc1
Docker version: 1.9.1, build a34a1d5
OS info: Red Hat Enterprise Linux Server release 6.6 (Santiago)
Linux 3.8.13-44.1.1.el6uek.x86_64 #2 SMP Wed Sep 10 06:10:25 PDT 2014 x86_64 x86_64 x86_64 GNU/Linux
bash-4.1$ echo $PATH
/home/me/bin/:/usr/lib64/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/bin:/usr/bin:/usr/dev_infra/platform/bin:/usr/dev_infra/generic/bin:/usr/local/bin:/usr/X11R6/bin
bash-4.1$ which docker-compose
/usr/bin/docker-compose
I kept a copy of the original (docker-compose.orig) when re-installing it the last time.
Corrupt version (much smaller):
bash-4.1$ ls -all /usr/bin/docker-compose
-rwxr-xr-x 1 root root 38312 Jan 21 15:51 /usr/bin/docker-compose
Original version:
bash-4.1$ ls -all /usr/bin/docker-compose.orig
-rw-r--r-- 1 root root 7934591 Jan 21 15:54 /usr/bin/docker-compose.orig
The curl instructions are for the pyinstaller version.
It sounds like the download was incomplete, since the file size is wrong?
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
Thanks Garth.
What you are saying sounds more like a _workaround_ than a _fix_ IMO.
The disabling prelinking for docker-compose is a workaround.
Getting pyinstaller to produce a valid ELF file is the proper fix. I'll raise an issue with them tomorrow
Nice, thanks for tracking this down and opening the issue on pyinstaller!
Yes, thanks again Garth.
Hi, just this issue on my vps:
uname -a
Linux poc2 3.12.53-guest-43-4751b4a-x86_64 #2 SMP Mon Feb 1 15:04:40 UTC 2016 x86_64 GNU/Linux
ls -l /usr/local/bin/docker-compose
-rwxr-xr-x 1 root staff 7925655 Feb 24 06:36 /usr/local/bin/docker-compose
I got this after trying to reinstall compose on a full drive with curl, here how I fixed it:
The error
# docker-compose
Cannot open self /usr/bin/docker-compose or archive /usr/bin/docker-compose.pkg
Happened with full disk
# df -h && du -h -d1 /var/lib/docker/devicemapper/devicemapper/data
Filesystem Size Used Avail Use% Mounted on
/dev/root 9.8G 9.8G 0 100% /
...
8.6G /var/lib/docker/devicemapper/devicemapper/data
so then
# docker rm `docker ps -aq`
still same error, reinstall docker-compose, problem solved for now
we had the issue today on a travis ci vm we use for a private repo
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.
On Ubuntu 14.04, any installer that strips the binary will break it. It will truncate it to a 29680 byte file and will result in the error message shown in the subject.
same problem
but I could not find a certain useful answer to solve it
Cannot open self /usr/local/bin/docker-compose or archive /usr/local/bin/docker-compose.pkg
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, but works by pip.
SO: Fedora 25
Linux localhost.localdomain 4.8.12-300.fc25.x86_64 #1 SMP Fri Dec 2 17:52:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Same problem, reason is curl download was incomplete. And no error output!!!
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
Same problem, I just download it from github, followed by @fae88 instructions, I had to run this command to solve permissions issue:
sudo chmod +x /usr/local/bin/docker-compose
Same problem, but I just reinstall it, then it work fine.
[1191] Cannot open self /usr/local/bin/docker-compose or archive /usr/local/bin/docker-compose.pkg
I also encountered this problem,Use curl to get.Network instability leads to this problem.
You can download it in your browser and copy it to Linux. This ensures that the download is ok.
This problem was solved, I did nothing but download the "docker-compose-Linux-x86_64" file again. The network sucks!
Stumbled into this problem too, and as @garthy reported it's because of prelink
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.
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.
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)
我也在CentOS 7上安装
docker-compose
了curl
å’Œchmod
方法。$ which docker-compose [19:24:40] /usr/local/bin/docker-compose
me too
me too
Same issue on Linux Mint.
Most helpful comment
I had same problem, it was because of permissions. This helped:
sudo chmod a+rx /usr/local/bin/docker-compose