How to install docker on Debian 11 "Bullseye"

Endrit Qerreti

Endrit Qerreti

In this tutorial, you will learn how to install docker engine on Debian 11 bullseye. Docker allows you to run multiple apps on your server with ease, without having to worry if these apps are going to be conflicting or causing any issues.

You can use docker on your server and computer, and manage apps the same way no matter the operating system you are running docker.  

Step 1 - Setup Docker Repository

To be able to install docker and other components required by docker, you need first to add the official repository of docker on your system.

Update your system

The commands below will update, and then install 3 packages on your system : ca-certificates, curl and gnupg

ca-certificates - Allows apt to download packages over https

curl - Is the package that we'll be using to download the official gpg key

gnupg - The package that encrypts and decrypt the gpg files

sudo apt-get update
sudo apt-get install ca-certificates curl gnupg

Import gpg key of docker

Before you proceed to import the gpg keys, let's explain what each command below does.

First command - Gives read and execute access to all users, and write access to the owner of the file only

Second command - Downloads the gpg key

Third command - Gives read access to docker's gpg key for all users

sudo install -m 0755 -d /etc/apt/keyrings

curl -fsSL | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

sudo chmod a+r /etc/apt/keyrings/docker.gpg

Once you import docker's gpg keys on your system, proceed to the next step.

Add official docker's repository to the sources.list file on your system

The command below will add the repository source of docker to your sources.list file.

echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Once you complete all steps above, move to the next step.

Step 2 - Update your system

Before you install docker on your system, make sure your system is updated. Run the command below to update your system

sudo apt update

Confirm by pressing Y and enter

Step 3 - Install docker

Installing docker is easy and it doesn't require too many commands. All you have to do is run one single command, and the installation will start.

sudo apt-get install docker-ce docker-ce-cli docker-buildx-plugin docker-compose-plugin

Command above will install three packages: Docker engine, docker compose and containerd

Confirm by pressing Y on  "Do you want to continue" to install docker

Note: Make sure you have sudo permission in order to be able to install and run docker after.

Step 4 - Test docker

After docker has been installed on your system, you can check its version by running the command below

docker version

And it should output the version of docker on your terminal as shown in the image below


In this tutorial, you learned how to install docker and its components on Debian 11 "Bullseye". Even though we installed docker on Debian 11 when we made this tutorial, you can also install docker on Debian 10 and Debian 12(testing version) by following the same installation steps we explained above.