docker-compose: Download latest release automatically
Since there is no package available for docker-compose, one always needs to check the latest release version and then adjust the cURL download command.
This step can be automated with fetching the latest release from the GitHub API first, and then using this detail in the cURL command. jq
is used for parsing the JSON output, in my opinion this is more convenient than other parsers.
apt -y install curl jq
VERSION=$(curl --silent "https://api.github.com/repos/docker/compose/releases" | jq -r '.[0].name')
curl -L "https://github.com/docker/compose/releases/download/$VERSION/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
This has been tested on Ubuntu 20.04 LTS.