Install Docker on Debian 11 bullseye system

Docker is used for creating, deploying, and managing containers for application development. It uses OS virtualization to isolate containers and allow them to communicate with each other. Dockers allow developers to easily ship, pack and run any application along with all dependencies in a standardized lightweight and portable container that can run virtually anywhere. Containers are much more efficient and faster than any other virtual machine because they are executable that serves the applications rather than running an entire operating system.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Docker queries.

In this context, we shall look into the installation of Docker community edition (CE) on the Debian 11 bullseye system.

Before proceeding with this Installation procedure, ensure that you are using a user with root privileges.


Steps to Install Docker engine on Debian 11 bullseye distribution

You need to follow the step by step process outlined below in order to complete the installation of Docker successfully on your system. 


1. Remove old Docker packages

If you installed Docker on your system before then, first you need to uninstall all older packages along with the dependencies called docker-engine or docker. However, the uninstallation process would not remove existing docker images, files, and networks that are present in the /var/lib/docker/ directory. So, run the below-mentioned command to uninstall the older docker version:

$ sudo apt remove -y docker docker-engine docker.io containerd runc


2. Install important Docker's packages 

Refresh the apt packages repository list by using the below-given command:

$ sudo apt update

Now, install some important required packages for the support the of HTTPS method by using the following command:

$ sudo apt install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common


3. Add the Docker's Repository

Here, import the Docker's repository GPG key on your system by running the below-mentioned command:

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

Once you have included the GPG key, run the following command to add the Docker's repository to the source list of your system:

$ 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

After adding a new docker's repository, refresh the apt repository by executing the 'sudo apt update' command.


4. Install Docker 

Once you setup the docker's repository on your Debian 11 bullseye system, install the Docker engine with the help of the following 'apt' command:

$ sudo apt install -y docker-ce docker-ce-cli containerd.io

Check the installation of Docker (CE) on the Debian 11 system by showing the information about the installed Docker's version as follows:

$ docker --version

Check the running status of the docker service by using the 'systemctl' command as follows:

$ sudo systemctl status docker


5. Test Docker installation

To test the Docker installation on your system, run the 'hello-world' docker contained by executing the below-mentioned command:

$ sudo docker run hello-world


How to Uninstall and Remove Docker from Debian Linux system ?

If you need to uninstall Docker, run the following command:

$ sudo apt-get purge docker-ce

The command deletes the docker-ce package. However, any additional files related to it, such as images, containers, and custom configuration files, remain on the system. Remove everything from the Docker directory with the command:

$ sudo rm -rf /var/lib/docker


[Need to resolve Docker connection issues ? We can help you. ]

This article covers how to install Docker engine on the Debian 11 bullseye system. In fact, Docker is a toolset to build applications and CI/CD pipelines to build, ship and run your applications in containers.

Related Posts