Skip to content

Instantly share code, notes, and snippets.

@SirJson
Last active October 9, 2020 03:59
Show Gist options
  • Save SirJson/07b9c4a5f2ef4b62c9c8f3a314c4b77b to your computer and use it in GitHub Desktop.
Save SirJson/07b9c4a5f2ef4b62c9c8f3a314c4b77b to your computer and use it in GitHub Desktop.
Install Docker on Ubuntu 20.x without reading the manual
#!/bin/bash
_install_docker() {
echo "> Starting Docker setup!"
apt-get remove docker docker.io containerd runc
apt-get update
apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
apt-get update
apt-get install docker-ce docker-ce-cli containerd.io
printf "\n\n== Test if docker works ==\n\n"
docker run hello-world
echo "> If you saw the hello world message everything went fine"
echo "> In case you saw something go wrong please read the manual: 'https://docs.docker.com/engine/install/ubuntu'"
}
printf "\n"
echo "> This script is for lazy people"
echo "> If you have no idea what are you doing please goto 'https://docs.docker.com/engine/install/ubuntu/'"
if [ "$EUID" -ne 0 ]
then echo "> And you are not root or using sudo. Sorry but you can't install Docker like that"
exit 1
fi
printf "\n\n"
echo "To continue enter the number of your choice"
select yn in "Yes" "No"; do
case $yn in
Yes ) _install_docker; break;;
No ) echo "> Docker setup canceled"; exit;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment