How to Install Docker in Debian 11 (Bullseye)

If you are an application developer that wishes to work under an open-source environment, then you will appreciate what docker has to offer in Debian 11 (Bullseye).

Docker provides a flexible way of developing, shipping, and running application containers under a defined operating system environment. Docker makes software delivery faster because targeted applications and their preferred development infrastructures are independent of each other.

Docker manages the software development and testing infrastructure while software developers manage running applications or one still under development.

Docker’s methodology significantly reduces the timeline between writing useful code and getting it ready for production. It results in faster testing, shipping, and deployment of applications codes.

Installing Docker in Debian 11

Make sure you are a sudoer user or have root user privileges before continuing with the article.

The first step is to update your Debian 11 system.

$ sudo apt update && sudo apt upgrade
Update Debian System
Update Debian System

Docker has several dependencies that we also need to install.

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

The next step is to configure the Docker repository by adding the Docker’s GPG key.

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

To configure Docker’s official repository, execute the following command.

$ echo "deb [arch=$(dpkg --print-architecture) 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
Add Docker Repository in Debian
Add Docker Repository in Debian

Now update your software package list again before installing the Docker engine.

$ sudo apt update

Install Docker engine with the following command:

$ sudo apt -y install docker-ce docker-ce-cli containerd.io
Install Docker in Debian
Install Docker in Debian

Once installed, verify the installed Docker version.

$ sudo docker version
Verify Docker in Debian
Verify Docker in Debian

Now start and enable Docker so that it runs even after the Debian 11 system reboots. After that, verify its service status.

$ sudo systemctl start docker
$ sudo systemctl enable docker
$ sudo systemctl status docker
Check Docker Status in Debian
Check Docker Status in Debian

Verifying Docker Installation in Debian

Now that we have Docker installed, we need to verify that it is working as per our expectations. The command below should spin up a ‘hello-world‘ container.

$ sudo docker run hello-world
Verify Docker Installation in Debian
Verify Docker Installation in Debian

The links from the above output should help you explore Docker in an in-depth approach.

Check Docker Documentation
Check Docker Documentation

Adding a user to the Docker group will not require them to use sudo while executing Docker commands. For instance, a user like dnyce can e added to the Docker group in the following manner.

$ sudo usermod -aG docker dnyce

This article has enabled us to understand what Docker has to offer on Debian 11 before walking us through its installation and verification steps. You should now be able to create application containers and comfortably explore all of Docker’s functionalities.

Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.