Created
November 15, 2021 04:49
-
-
Save orrisroot/eed9c0d615d2c1938e3b3b5d8591d7cb to your computer and use it in GitHub Desktop.
Setup docker compose plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for cmd in docker curl jq; do | |
if ! command -v ${cmd} > /dev/null; then | |
echo "Error: ${cmd} is required to setup docker compose plugin." 1>&2 | |
exit 1 | |
fi | |
done | |
DOCKER_COMPOSE="${HOME}/.docker/cli-plugins/docker-compose" | |
VERSION=$(curl -sL https://api.github.com/repos/docker/compose/releases/latest | jq -r ".tag_name") | |
VERSION_="" | |
if [ -x "${DOCKER_COMPOSE}" ]; then | |
VERSION_=$(docker compose version --short) | |
fi | |
if [ "${VERSION}" != "${VERSION_}" ]; then | |
curl -fsSL "https://github.com/docker/compose/releases/download/${VERSION}/docker-compose-linux-$(uname -m)" --create-dirs -o "${DOCKER_COMPOSE}" && \ | |
chmod 755 ${DOCKER_COMPOSE} | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment