Last active
May 27, 2022 13:54
-
-
Save v3rlly/280a7184467117b2379b44c2cbd13783 to your computer and use it in GitHub Desktop.
Install Docker on Debian 11 Bullseye (one line)
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 | |
# | |
# Install docker on Debian 11 Bullseye with one line | |
# | |
set -u; | |
# Check if user is root. | |
[[ ! $(id -u) -eq 0 ]] && echo "Run as root." && exit 1; | |
# Uninstall old versions | |
apt remove docker docker-engine docker.io containerd runc 2>/dev/null; | |
# Set up the repository | |
# 1. Update the apt package index and install packages to allow apt to use a repository over HTTPS: | |
apt update; | |
sudo apt-get install \ | |
ca-certificates \ | |
curl \ | |
gnupg \ | |
lsb-release; | |
# 2. Add Docker’s official GPG key: | |
mkdir -p /etc/apt/keyrings | |
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg; | |
# 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/debian \ | |
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null; | |
# Install Docker Engine | |
apt update; | |
apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin; | |
# done. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment