Skip to content

Instantly share code, notes, and snippets.

@johnhpatton
Last active July 8, 2024 22:21
Show Gist options
  • Save johnhpatton/9640d8c219ff10c1732e774297cdd6fa to your computer and use it in GitHub Desktop.
Save johnhpatton/9640d8c219ff10c1732e774297cdd6fa to your computer and use it in GitHub Desktop.
Install latest docker compose
UNAME_M=$(uname -m)
UNAME_S=$(uname -s)
UNAME_S=${UNAME_S,,}
[[ $UNAME_M =~ amd64|x86_64 ]] && ARCH=x86_64 || ARCH=aarch64
URL_GITHUB_DOCKER_COMPOSE_RELEASES_API="https://api.github.com/repos/docker/compose/releases/latest"
URL_GITHUB_DOCKER_COMPOSE_RELEASES_DOWNLOAD_PREFIX="https://github.com/docker/compose/releases/download"
DOCKER_COMPOSE_LATEST_VERSION=$(curl -s "${URL_GITHUB_DOCKER_COMPOSE_RELEASES_API}" | grep '.tag_name' | sed -r 's/^[^:]*:.*\"(.*)\".*/\1/')
URL_GITHUB_DOCKER_COMPOSE_DOWNLOAD="${URL_GITHUB_DOCKER_COMPOSE_RELEASES_DOWNLOAD_PREFIX}/${DOCKER_COMPOSE_LATEST_VERSION}/docker-compose-${UNAME_S}-${ARCH}"
BIN_DOCKER_COMPOSE=${DOCKER_CONFIG:-$HOME/.docker/cli-plugins/docker-compose}
curl -fsSL -o "${BIN_DOCKER_COMPOSE}" "${URL_GITHUB_DOCKER_COMPOSE_DOWNLOAD}"
chmod +x "${BIN_DOCKER_COMPOSE}"
docker compose version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment