Skip to content

Instantly share code, notes, and snippets.

@DrSnowbird
Last active December 16, 2018 02:05
Show Gist options
  • Save DrSnowbird/19cea338bc67ead2cc122a578143aa0a to your computer and use it in GitHub Desktop.
Save DrSnowbird/19cea338bc67ead2cc122a578143aa0a to your computer and use it in GitHub Desktop.
docker-compose-install.sh
#!/bin/bash -x
# ref: https://docs.docker.com/compose/install/#install-compose
LATEST_VERSION=
function get_latest_release() {
REPO=${1:-docker}
COMPONENT=${2:-compose}
# basename `curl --silent https://github.com/docker/compose/releases/latest|cut -d'"' -f2`
LATEST_VERSION="$(basename `curl --silent https://github.com/${REPO}/${COMPONENT}/releases/latest|cut -d'"' -f2`)"
}
get_latest_release
#sudo curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/${LATEST_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
# Use the latest Compose release number in the download command.
# The above command is an example, and it may become out-of-date. To ensure you have the latest version, check the Compose repository release page on GitHub.
# If you have problems installing with curl, see Alternative Install Options tab above.
# Apply executable permissions to the binary:
sudo chmod +x /usr/local/bin/docker-compose
# Test the installation.
docker-compose --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment