How to install Docker on Debian 11

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"

Hello, folks from the unixcop community. This post is a simple guide that will allow us to install Docker on Debian 11. Being such an important technology, it is necessary to start working with it. And nothing better than to start learning how to install it.

Quickly what is Docker

Docker is a software development platform for virtualization with multiple operating systems running on the same host. This is made possible by containers that are distributed as images.

The system is very lightweight because it does not incorporate an operating system, which also allows for better use of resources. Docker also allows applications to be isolated, which is very useful for testing without bringing down the client’s production server.

Although Docker is a very complex technology, it can be easily controlled through a series of commands.

Unlike virtual machines that can communicate with the host hardware, Docker containers run in an isolated environment on top of the host operating system.

So, let’s learn how to install it on Debian 11.

Preparing the system for Docker

Before starting the installation, we need to prepare the system for installation.

First, open a terminal or connect via SSH and upgrade the server you’re using

sudo apt update
sudo apt upgrade

Note: In this post, I will use sudo. If you don’t have access to it, then you have to run the commands as root

After that, it is necessary to install packages like apt-transport-https or ca-certificates and others for the system to be able to add the Docker repository without problems.

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

In addition to the aforementioned packages, we also need to install curl which will allow us to download Docker-related files.

Install Docker on Debian 11

Although Docker is present in the official Debian repositories, it is convenient to add the external repository to get the latest stable version.

So, let’s go for it.

First, download the GPG key from the repository to make sure the packages are verified and the system can install them without errors.

curl -fsSL | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

With the GPG key effectively added to the system, you can then add the repository

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

And to install Docker on Debian 11 just run

sudo apt update
sudo apt install docker-ce docker-ce-cli

You can check the version that has been installed on the system by running

docker --version
Docker version 20.10.10, build b485636

Remember that before using Docker, you have to enable the service to start with the system. This is recommended because if there is a reboot then Docker will automatically start and probably your containers as well.

sudo systemctl enable docker.service
Synchronizing state of docker.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd/systemd-sysv-install enable docker

sudo systemctl enable containerd.service

And to check the status of Docker, you can run

sudo systemctl status docker

A good practice is to run Docker commands without being root. To do this you have to run the following commands

sudo groupadd docker
sudo usermod -aG docker $USER

And to apply the changes log out and log back in.

Running a hello world image to test Docker on Debian 11

The best way to find out if Docker is working properly on the system is to run a test image called hello-world.

To do this, simply run

docker run hello-world

If the output looks like this, then all is well with Docker and you are good to go.

Docker on Debian 11
Docker on Debian 11

So, enjoy it.


In this post, you have learned how to install Docker on Debian 11 quickly and easily. This technology will help you with the deployment of containerized applications while ensuring integrity and security.

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"
I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.


Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook