Docker is an open-source and most popular platform nowadays. It provides support to create and run applications in isolated ‘containers’. 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.
You will go through this article about the installation of Docker community edition (CE) on the Debian 11 bullseye system using the command line approach.
- You must need root privileges.
- The user required a 64-bit version of the Debian 11 operating system.
Installation of Docker engine on Debian 11 bullseye distribution
The installation of Docker will complete into the number of steps, which are provided below:
Step 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
Step 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
The following output will print after installing all the above-required Docker packages.
Step 3: Add the Docker’s Repository
In this step, 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.
Step 4: Docker installation on Debian 11 system
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
The installed docker version should display on the terminal window, which is also shown in the below-given screenshot:
Check the running status of the docker service by using the ‘systemctl’ command as follows:
$ sudo systemctl status docker
Step 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
The following output shows on the terminal that verifies the correct installation of the Docker engine on your Debian 11 bullseye distribution.
Congratulations! The Docker engine is installed on the Debian 11 system. We explored different commands in this article for the installation of the Docker engine on the Debian 11 bullseye system. In the next coming articles, we will also show you how to allow access to non-root users to execute the docker commands. Thanks!
Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.