Skip to content

Instantly share code, notes, and snippets.

@dpacmittal
Created October 19, 2019 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpacmittal/df701bda2619882ccd3079833d254552 to your computer and use it in GitHub Desktop.
Save dpacmittal/df701bda2619882ccd3079833d254552 to your computer and use it in GitHub Desktop.
Bash script to install docker on debian based distros
#!/bin/bash
GREEN='\033[0;32m'
NC='\033[0m' # No Color
if [[ $# -ne 1 ]]; then
echo "Usage: bootstrap.sh <username>"
exit
fi
echo -e "\n\n${GREEN}Removing older docker version... ${NC}\n\n"
sudo apt-get remove docker docker-engine docker.io containerd runc
echo -e "\n\n${GREEN}Updating packages and installing dependencies...${NC}\n\n";
sudo apt update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
echo -e "\n\n${GREEN}Adding docker repo...${NC}\n\n"
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
echo -e "\n\n${GREEN}Docker repo fingerpring${NC}\n\n";
sudo apt-key fingerprint 0EBFCD88;
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io
echo -e "\n\n${GREEN}Installing docker compose${NC}\n\n";
sudo apt install python3-pip
sudo pip3 install docker-compose
echo -e "\n\n\n\n${GREEN}Adding users${NC}\n\n";
sudo groupadd docker
sudo useradd webxmedia
sudo usermod -aG docker webxmedia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment