Forked from luislobo/install_latest_docker_compose.sh
Last active
May 22, 2019 17:55
-
-
Save Bonno/b5cf766cea40ffd18157bf0d069676e2 to your computer and use it in GitHub Desktop.
Install Latest Docker and Docker-compose on Ubuntu
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
# Ask for the user password | |
# Script only works if sudo caches the password for a few minutes | |
sudo true | |
## | |
## https://docs.docker.com/install/linux/docker-ce/ubuntu | |
## | |
# Install packages to allow apt to use a repository over HTTPS: | |
sudo apt install apt-transport-https ca-certificates curl software-properties-common | |
# Add Docker’s official GPG key: | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
# Use the following command to set up the stable repository. You always need the stable repository, | |
# even if you want to install builds from the edge or test repositories as well. To add the edge or test | |
# repository, add the word edge or test (or both) after the word stable in the commands below. | |
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" | |
sudo apt-get update | |
sudo apt install docker-ce | |
# Add current user to docker group. Need reboot | |
echo "Add user '$USER' to group 'docker'. Log out and log back in so that your group membership is re-evaluated." | |
sudo usermod -aG docker $USER | |
# Get latest docker compose released tag | |
docker_compose_version="$(git ls-remote https://github.com/docker/compose | grep "refs/tag" | grep -oP "[0-9]+\.[0-9]+\.[0-9]+$" | sort -V | tail -n1)" | |
# Install docker-compose | |
sudo sh -c "curl -L https://github.com/docker/compose/releases/download/$docker_compose_version/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose" | |
sudo chmod +x /usr/local/bin/docker-compose | |
sudo sh -c "curl -L https://raw.githubusercontent.com/docker/compose/$docker_compose_version/contrib/completion/bash/docker-compose > /etc/bash_completion.d/docker-compose" | |
# Install docker-cleanup command | |
cd /tmp | |
git clone https://gist.github.com/76b450a0c986e576e98b.git | |
cd 76b450a0c986e576e98b | |
sudo mv docker-cleanup /usr/local/bin/docker-cleanup | |
sudo chmod +x /usr/local/bin/docker-cleanup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
curl -s https://gist.githubusercontent.com/Bonno/b5cf766cea40ffd18157bf0d069676e2/raw/c1a36936b09b9bb1a541496cd5d15a6dbb6489d3/install_latest_docker_compose.sh | bash /dev/stdin