Docker

For the installation of Docker, first thing you have to do is to add the official GPG key of the Docker repositories, then add this repository (“PPA”) to the package sources, and then update the package cache. For safety reasons to prevent version confusion, packages that have been installed previously will be removed.


for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runcdocker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin runc; do sudo apt purge -y $pkg; done

sudo apt update
sudo apt install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

For Ubuntu and its derivated (like Linux Mint) add the repo like this:


echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$UBUNTU_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update

Use this for debian and its derivates:


echo \
   "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
   $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
   sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

To install Docker:


sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

To check the installation:


sudo docker run hello-world

After the installation you can use this to add you user to the group docker, so you can issue orders without having to use sudo every time:


sudo groupadd docker
sudo usermod -aG docker $USER

Afterwards, reboot your PC.

To check, whether you can issue Docker commands as “normal” user, use:


docker run hello-world

If everything works as intended use these commands to enable the services:


sudo systemctl enable --now docker.service
sudo systemctl enable --now containerd.service

Source: