6

I am trying to install docker-compose on my computer (Ubuntu), after several failed attempts using curl,wget, and apt, I decided to download it directory from the repository and move it to usr/local/bin/docker-compose.

However, I keep getting the error Cannot open self /usr/local/bin/docker-compose or archive /usr/local/bin/docker-compose.pkg

I have tried several approaches: - reinstallation - changing of file permissions - installing with wget, curl, and apt, and it is not working.

0

3 Answers 3

7

Seeing the same issue and found the solution from this page, by use following instead:

curl -L https://github.com/docker/compose/releases/download/1.27.4/docker-compose-`uname -s`-`uname -m` > ~/docker-compose
chmod +x ~/docker-compose
sudo mv ~/docker-compose /usr/local/bin/docker-compose
docker-compose run test

In my original case which cannot reproduce at the later time, I cannot even use sudo rm -f /usr/local/bin/docker-compose to remove the original downloaded docker-compose file. Finally I used sudo lsattr /usr/local/bin/docker-compose, then sudo chattr -a /usr/local/bin/docker-compose to clear the attributes that blocked the removal.

1
  • But why does this happen in the first place? Can I be sure it won't repeat now?
    – Gulzar
    Jan 27 at 14:30
1

As you did not give details on your "several failed attempts", I can only guess that you did not follow the right instructions.

There exists an issue from 2015 on github on the same problem. From that issue, it seems that the way how to solve it is to install it exactly like the official documentation says:

sudo curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

(Please look in the docs for the current version number)

Same for docker itself, use the official installation documentation and not the package provided from Ubuntu, it is usually outdatet.

1
  • Thank you @pLumo I started with the documentation and what you just posted here is exactly what I started with. I also listed the failed attempts - I tried to use curl as used in the documentation, then I tried to use wget, then I tried installing with apt, then I downloaded the file directly from their official repository and moved it to /usr/local/bin/docker-compose Apr 13, 2020 at 11:46
1

This issue continues existing, at least in Ubuntu 18.04. I've installed docker-compose using curl and it works fine, but after some time, I don't know how the executable is modified (I've checked it comparing the md5sum of /usr/local/bin/docker-compose just after downloading it and after it failed and they were different).

I've set the immutable bit of the executable using chattr:

chattr +i /usr/local/bin/docker-compose

and, for the moment, it seems to work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.