Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
zirkome opened this issue Mar 19, 2015 · 67 comments
Closed
Milestone

Comments

@zirkome
Copy link

zirkome commented Mar 19, 2015

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!

@jasherai
Copy link

👍 I'm experiencing this too... not sure what extra info would be useful to help debug

@funkyfuture
Copy link

how have you installed it? what operating system are you using? what's the output of which docker-compose?

@jasherai
Copy link

jasherai commented Apr 1, 2015

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

@zirkome
Copy link
Author

zirkome commented Apr 2, 2015

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

@funkyfuture
Copy link

does it work when you install compose with pip?

@hajaalin
Copy link

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

@funkyfuture
Copy link

@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

@hajaalin
Copy link

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

@jasherai
Copy link

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

@djsly
Copy link

djsly commented May 14, 2015

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

@arangamani
Copy link

I have the same problem as well. I'm on Mac OSX.

@frol
Copy link

frol commented May 19, 2015

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)

@joestubbs
Copy link

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.

@sudhishkr
Copy link

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.

@pendexgabo
Copy link

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.

@lostsnow
Copy link

lostsnow commented Jul 6, 2015

+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

@rocLv
Copy link

rocLv commented Jul 13, 2015

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.

@wrenzi
Copy link

wrenzi commented Aug 3, 2015

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

@aanand
Copy link

aanand commented Aug 3, 2015

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.

@pendexgabo
Copy link

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.

@aanand
Copy link

aanand commented Aug 3, 2015

Anyone experiencing this issue, please tell us:

  1. Your operating system, distro, version etc.
  2. The output of ls -l /usr/local/bin/docker-compose immediately after following the install instructions
  3. The output of ls -l /usr/local/bin/docker-compose immediately after getting the Cannot open self error

@wrenzi
Copy link

wrenzi commented Aug 4, 2015

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

@aanand
Copy link

aanand commented Aug 4, 2015

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

@wrenzi
Copy link

wrenzi commented Aug 4, 2015

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

@aanand
Copy link

aanand commented Aug 4, 2015

To anyone else experiencing the issue:

  1. Where are you installing docker-compose to?
  2. What's the output of echo $PATH and which docker-compose after it runs successfully?
  3. What's the output of echo $PATH and which docker-compose after you get the error?

This might be an issue with improperly configured PATH variables.

@lostsnow
Copy link

lostsnow commented Aug 5, 2015

  1. Where are you installing docker-compose to?

    /usr/bin/docker-compose

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

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

@aanand
Copy link

aanand commented Aug 5, 2015

@lostsnow

  1. Why /usr/bin and not /usr/local/bin?
  2. What's the output of ls -l /usr/bin/docker-compose after running successfully?
  3. What's the output of ls -l /usr/bin/docker-compose after getting the error?

@lostsnow
Copy link

lostsnow commented Aug 6, 2015

@aanand

  1. Why /usr/bin and not /usr/local/bin?

    I just put it here

  2. What's the output of ls -l /usr/bin/docker-compose after running successfully?

    ls -l /usr/bin/docker-compose

    -rwxr-xr-x 1 root root 8182592 Jul 31 16:35 /usr/bin/docker-compose

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

@aanand
Copy link

aanand commented Aug 6, 2015

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.

@dave-tucker
Copy link

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

garthy added a commit to garthy/compose that referenced this issue May 12, 2016
…alid ELF file to stop prelinking breaking compose

Signed-off-by: Garth Bushell <garth@garthy.com>
@robertkowalski
Copy link

we had the issue today on a travis ci vm we use for a private repo

@pmontrasio
Copy link

pmontrasio commented Sep 5, 2016

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.

@Zlo
Copy link

Zlo commented Oct 13, 2016

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.

@fae88
Copy link

fae88 commented Nov 22, 2016

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

@sandokandias
Copy link

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

@ThomasWaldmann
Copy link

@shin- shin- added this to the 1.11.0 milestone Jan 30, 2017
@Tan-Tshunglee
Copy link

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

@xavierholt
Copy link

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

@OrDuan
Copy link

OrDuan commented Sep 13, 2017

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

@tianhaoo
Copy link

Same problem, but I just reinstall it, then it work fine.

@shenhzdl
Copy link

shenhzdl commented Mar 8, 2019

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

@shellcompute
Copy link

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

@ffissore
Copy link

ffissore commented May 8, 2019

Stumbled into this problem too, and as @garthy reported it's because of prelink

@zensmartblox
Copy link

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.

@hugo0129
Copy link

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.

@regzon regzon mentioned this issue Apr 4, 2020
Closed
@pea3nut
Copy link

pea3nut commented Apr 4, 2020

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)

@wf4867612
Copy link

我也在CentOS 7上安装docker-composecurlchmod方法。

$ which docker-compose                                                                                                                                              [19:24:40]
/usr/local/bin/docker-compose

me too

@Orocker
Copy link

Orocker commented Oct 9, 2020

me too

@ScarletMcLearn
Copy link

Same issue on Linux Mint.

@brevvi
Copy link

brevvi commented Mar 16, 2021

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 ran this command as root user, and it worked for me.

@SaiSridhar783
Copy link

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.

Dude thanks a lot! Works like a charm

@lorenzoranucci
Copy link

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!

@aino-gautam
Copy link

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

this solved the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests