Skip to content

Instantly share code, notes, and snippets.

@rogervila
Last active October 25, 2018 11:58
Show Gist options
  • Save rogervila/f14f5ee997604859c1ffc7ab7a89fdea to your computer and use it in GitHub Desktop.
Save rogervila/f14f5ee997604859c1ffc7ab7a89fdea to your computer and use it in GitHub Desktop.
Install docker on ubuntu
#!/usr/bin/env bash
cd "$(dirname "$0")"
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update -y
echo -e "\e[32mInstalling docker...\e[0m"
sudo apt-get remove docker docker-engine docker.io docker-compose -y
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update -y
sudo apt-get install docker-ce -y
echo -e "\e[32mInstalling docker-compose...\e[0m"
curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-`uname -s`-`uname -m` > ./docker-compose
sudo rm /usr/bin/docker-compose
sudo mv ./docker-compose /usr/bin/docker-compose
sudo chmod +x /usr/bin/docker-compose
echo -e "\e[32mFixing permissions...\e[0m"
sudo groupadd docker
sudo usermod -aG docker $USER
sudo gpasswd -a $USER docker
echo -e "\e[32mConfiguring Docker to start on boot...\e[0m"
sudo systemctl enable docker
sudo systemctl daemon-reload
sudo systemctl restart docker.service
echo -e "\e[32mDone!\e[0m"
echo -e "\\e[44mINFO\\e[0m If you have problems using docker without sudo, reboot the machine \\e[0m"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment