I am trying to upgrade docker-compose since with the current version I get some error when running a .yml file. Here my current situation:

$ which docker
$ which docker compose

$ ls -al | grep docker
-rwxr-xr-x  1 root   root    13511128 Feb 28 09:02 docker
-rwxr-xr-x  1 root   root         336 Dez 11  2015 docker-compose
-rwxr-xr-x  1 root   root    11314960 Feb 28 09:01 docker-containerd
-rwxr-xr-x  1 root   root    10464424 Feb 28 09:01 docker-containerd-ctr
-rwxr-xr-x  1 root   root     1976648 Feb 28 09:01 docker-containerd-shim
-rwxr-xr-x  1 root   root    39473368 Feb 28 09:03 dockerd
-rwxr-xr-x  1 root   root      862296 Feb 28 09:01 docker-init
-rwxr-xr-x  1 root   root     2573840 Feb 28 09:01 docker-proxy
-rwxr-xr-x  1 root   root     8195464 Feb 28 09:01 docker-runc

When tryint to update docker-compose from https://github.com/docker/compose/releases. The output of the command:

sudo curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-`uname -s`-`uname -m` > /usr/bin/docker-compose

gives me:

bash: /usr/bin/docker-compose: Permission denied

I am also sudoing the command. Why is that? thanks


The source of the problem is that the sudo will be execute only on the curl part of the command, and not on the > part of the commeand.

You can cause sudo to run on both parts of the command in the following way:

sudo bash -c "curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-`uname -s`-`uname -m` > /usr/bin/docker-compose"

The simple solution might be:

  1. Download the file

    wget https://github.com/docker/compose/releases/download/1.11.2/docker-compose-uname -s-uname -m

  2. use sudo to place it in the right location

    sudo mv docker-compose-`uname -s`-`uname -m` /usr/bin/docker-compose

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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