Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@realFranco
Created September 9, 2022 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save realFranco/ceec5d106420715534767a66ad66dab2 to your computer and use it in GitHub Desktop.
Save realFranco/ceec5d106420715534767a66ad66dab2 to your computer and use it in GitHub Desktop.
Upgrade docker-compose to 1.2.7.0 on ubuntu 20.04 LTS
> docker version
# mi versión de docker compose actual no me permite ejecutar compose > 3.7
> docker-compose -v
# docker-compose version 1.25.0, build unknown
> which docker-compose
# /usr/bin/docker-compose
# backup the old docker-compose
> sudo cp /usr/bin/docker-compose /usr/bin/docker-compose_old
> sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/bin/docker-compose
> sudo chmod +x /usr/bin/docker-compose
> which docker-compose
/usr/bin/docker-compose
> docker-compose -v
> docker-compose version 1.27.4, build 40524192
# References:
# https://packages.ubuntu.com/search?keywords=docker-compose&searchon=names&suite=all&section=all
# https://github.com/datahub-project/datahub/issues/2020#issuecomment-736850314
# https://docs.docker.com/compose/compose-file/compose-versioning/#version-38
@realFranco
Copy link
Author

The mayor version v2.x.y in contrast with the version v1.x.y the Operative System distribution infix "Linux" is lowercase (v1.x.y is uppercase) for that reason the curl need to be modified, the rest of the script it is the same.

UNAME_S="$(uname -s)"
UNAME_S="${UNAME_S,}"

sudo curl -L "https://github.com/docker/compose/releases/download/v2.10.2/docker-compose-${UNAME_S}-$(uname -m)" -o /usr/bin/docker-compose

You can chain the string manipulation and use an inline command, feel free to improve it!

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