Last active
August 14, 2023 19:15
-
-
Save freitzzz/180dc45ad110fac3f12124abffd16fdf to your computer and use it in GitHub Desktop.
(debian/ubuntu/elementaryos) One click Docker Install script
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
#!/usr/bin/env bash | |
# This is an one-click install script using the instructions listed on the official Docker docs: https://docs.docker.com/engine/install/debian/ | |
# This script is intended to be run on Debian / Ubuntu based systems. | |
banner=" _____ __ | |
/__ / ____ _____/ /_____ _____ | |
/ / / __ \/ ___/ //_/ _ \/ ___/ | |
/ /__/ /_/ / /__/ ,< / __/ / | |
/____/\____/\___/_/|_|\___/_/ | |
A one-click install script for Docker in Debian / Ubuntu based systems. | |
Run this script anytime over the Internet: wget -qO- \"https://gist.githubusercontent.com/freitzzz/180dc45ad110fac3f12124abffd16fdf/raw/docker_install.bash\" | bash | |
" | |
echo "$banner" | |
# 0. Uninstall (if any) old Docker versions | |
sudo apt-get remove -y docker docker-engine docker.io containerd runc | |
# 1. Setup Docker APT repositories | |
# 1.1 Update the apt package index and install packages to allow apt to use a repository over HTTPS: | |
sudo apt-get update | |
sudo apt-get install -y \ | |
ca-certificates \ | |
curl \ | |
gnupg \ | |
lsb-release | |
# 1.2 Add Docker’s official GPG key: | |
os_codename="$(echo $(lsb_release -i -s) | tr '[:upper:]' '[:lower:]')" | |
os_dist="$(lsb_release -c -s)" | |
sudo mkdir -m 0755 -p /etc/apt/keyrings | |
curl -fsSL https://download.docker.com/linux/$os_codename/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg | |
# 1.3 Use the following command to set up the repository: | |
echo \ | |
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/$os_codename \ | |
$os_dist stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
# 1.4 Make sure Docker repository public key file is readable | |
sudo chmod a+r /etc/apt/keyrings/docker.gpg | |
# 1.5 Update Docker repository index | |
sudo apt-get update | |
# 2. Setup Docker Engine | |
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin | |
# 3. Add docker group to user | |
sudo groupadd docker | |
sudo usermod -aG docker $USER | |
newgrp docker | |
# 4. Verify that the Docker Engine installation is successful by running the hello-world image | |
docker run hello-world | |
# <EOF> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment