Skip to content

Instantly share code, notes, and snippets.

Last active January 30, 2024 17:49
  • Star 71 You must be signed in to star a gist
  • Fork 26 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save deviantony/2b5078fe1675a5fedabf1de3d1f2652a to your computer and use it in GitHub Desktop.
Install latest version of Docker Compose
## Nowadays, simply follow the Compose installation instructions in the official documentation:
# get latest docker compose released tag
COMPOSE_VERSION=$(curl -s | grep 'tag_name' | cut -d\" -f4)
# Install docker-compose
sh -c "curl -L${COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose"
chmod +x /usr/local/bin/docker-compose
sh -c "curl -L${COMPOSE_VERSION}/contrib/completion/bash/docker-compose > /etc/bash_completion.d/docker-compose"
# Output compose version
docker-compose -v
exit 0
Copy link

rjalexa commented Feb 7, 2020

Thank you very much.

Copy link

Found this useful thanks.

Copy link

Thank you so much!

Copy link

I found a much simpler solution today, just use pip install docker-compose (just be sure to have pip package manager installed) and you´ll get the current Compose version installed.

It's not much simpler (be sure to have pip) , this batch is for everyone and it's more simpler for all user

Copy link

withakay commented Feb 8, 2021

There is a simpler way to do this.
Github provides a method to link directly to the latest release, see here where it states "To link directly to a download of your latest release asset, link to /owner/name/releases/latest/download/"

So for docker-compose we just need to use:
sudo curl -L "$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Copy link

really useful script after struggling for a long time with official doc ! Thx

Copy link

This s so awesome thank you so very much for the script.

Copy link

If you do not want to use v2 you can use the following:
curl -s | grep -e 'tag_name\": "1.' | cut -d\" -f4 | head -n 1

Copy link

@withakay thanks it works! 👍

Copy link

This is a 6y old gist :)

There's an easy way to install Compose nowadays in their documentation, I'd recommend using this approach instead:

Copy link

That was a piece of cake :)

Copy link

Docker Desktop includes docker-compose these days,

Copy link

bumbummen99 commented Jul 16, 2022

Docker Desktop includes docker-compose these days,

You can even link docker-compose to the compose plugin in the docker folder for compatibility.

ln -s /usr/local/bin/docker-compose /usr/libexec/docker/cli-plugin/docker-compose

Copy link

hishayu commented Aug 22, 2022

Thanks so much!

Copy link

Great!! Thanks a lot!!!

Copy link

tpoxa commented Jan 20, 2024

perhaps hash -r?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment