docker, debian,

How to install Docker on Debian 11

Aug 18, 2021 · 1 min read · Post a comment

Finally, Debian 11 is released on August 14th, 2021, and this version is marked as a stable version. This tutorial will show you the steps on how to install Docker on a new fresh Debian 11 instance.

Prerequisites

  • Debian 11
  • sudo privileges

Install the latest Docker version on Debian 11

Step 1. Update the apt package index.

sudo apt-get update

Step 2. Allow apt to use a repository over HTTPS.

sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

Step 3. Now add Docker GPG key.

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Step 4. In order to add the Docker stable repository, we need to execute the following command:

echo \
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Step 5. To install the latest Docker version, we need to update the apt package index, and then install the latest version of Docker.

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

Install a specific Docker version on Debian 11

To install a specific Docker version you need to complete the above 4 steps (without executing Step 5) and run:

sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io

Uninstall Docker Engine on Debian 11

If you decide to uninstall Docker for some reason, run:

sudo apt-get purge docker-ce docker-ce-cli containerd.io
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd

Conclusion

This tutorial shows you the installation Docker steps on a fresh released Debian 11 version, which is quite simple and easy. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.