Last active
August 12, 2020 05:27
-
-
Save AllieUbisse/67af68e412e0930579714925ce09b6f4 to your computer and use it in GitHub Desktop.
How to Automate Docker installation by executing a Bash script from GitHub Gist π
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 | |
################################################################################## | |
# ---------------------------------------------------------------- | |
# THIS SCRIPT WILL HELP YOUR AUTOMATE THE DOCKER INSTALATION STEPS | |
# ---------------------------------------------------------------- | |
# Test was ran on aws ec2 instance. | |
# | |
# AUTHOR: | |
# Name: Allie Silver Ubisse | |
# Email: [email protected] | |
################################################################################## | |
# | |
# | |
# | |
echo "============================================================================" | |
echo "( 1 of 7 ) WARNING: You are about to install docker to your machine " | |
echo "============================================================================" | |
# | |
sudo apt-get update | |
echo "=========================================================================================================" | |
echo "( 2 of 7 ) Installing: curl apt-transport-https ca-certificates gnupg-agent software-properties-common " | |
echo "=========================================================================================================" | |
sudo apt-get install \ | |
apt-transport-https \ | |
ca-certificates\ | |
curl \ | |
gnupg-agent \ | |
software-properties-common -y && | |
echo "============================================================================" | |
echo "( 3 of 7 ) TASK " | |
echo "============================================================================" | |
# | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - && | |
sudo add-apt-repository \ | |
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ | |
$(lsb_release -cs) \ | |
stable" && | |
echo "============================================================================" | |
echo "( 4 of 7 ) INSTALLING: docker-ce docker-ce-cli containerd.io " | |
echo "============================================================================" | |
# | |
sudo apt-get install docker-ce docker-ce-cli containerd.io -y && | |
apt-cache madison docker-ce && | |
echo "============================================================================" | |
echo "( 5 of 7 ) INSTALLING: docker.io " | |
echo "============================================================================" | |
# | |
sudo apt install docker.io -y && | |
echo "============================================================================" | |
echo "( 6 of 7 ) INSTALLING: docker-compose " | |
echo "============================================================================" | |
# | |
sudo apt install docker-compose -y && | |
echo "============================================================================" | |
echo "( 7 of 7 ) Thank you!, Report any bugs and star the gist " | |
echo "============================================================================" | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
π HOW TO USE THE SCRIPT π
π Do not forget to star β the gist so it can help a lot of people
bash <(curl -Ls https://gist.githubusercontent.com/AllieUbisse/67af68e412e0930579714925ce09b6f4/raw/140d0898331d2d90279169cbeb456cc10023ab64/docker_installer.sh)
Feel free to change $USER to your custom user NB: $USER returns the name of the current login user.
sudo usermod -a -G docker $USER
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
πVerify that you can run docker commands without sudo
π REPORT β¨ :
If you get ERROR:
To fix this problem, either remove the ~/.docker/ directory (it is recreated automatically, but any custom settings are lost), or change its ownership and permissions using the following commands:
Kindly report any bugs or additional features due to script
π credits:
πΉ @soumilshah1995 youtube channel π₯
π @Jens Answer on StackOverFlow ubuntu 20.x bug fix π₯
π― Docker docs
π Create a docker image AWS EC2