Docker is a framework that is utilized for developing container-based applications. These containers are the lightweight and small execution environments that share the operating system kernel; however, they operate in isolation. At that time, the containers were already used in Linux-based systems. The Docker project made it easier for developers to package their application as a “build once and run anywhere” strategy.

Docker Container

Docker Containers can be thought of as executable images. With the use of Docker API or CLI, you can perform different operations in a Docker container. It also provides you the facility to connect a container to one or more networks, attach any storage it, or create a new Docker image out of an existing state.

A container is often well separated from its host and default machine. You have control over the isolated network of a container, its storage, and other underlying subsystems. The image of a container and any configuration parameters you provide is used for building or starting it. Any changes to a container’s state that are not saved in persistent storage are lost when the container is removed.

Benefits of using Docker on Debian 11

One of the best things about using an open-source project is the freedom to choose the technology you want to utilize to complete any task. Docker is suitable for developers who require a lightweight, small, and clean environment for testing purposes and wish to avoid extensive management and configurations. It can also test, ship, and deploy code quickly, which helps minimize the delay between writing code and executing it in an environment.

If Docker is installed on your system and everyone around you have some know-how related to Docker toolchain, then Docker Community Edition (CE) is the platform for you to get started with containers.

How to install Docker dependencies

First of all, open up your Debian terminal by pressing “CTRL ALT T” and execute the below-given command for updating the system repositories:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/install-docker-debian-01-e1633662136648.png" data-lazy- height="195" src="data:image/svg xml,” width=”824″>

In the next step, we will add the required Docker dependencies to the system.

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

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/install-docker-debian-02.png" data-lazy- height="506" src="data:image/svg xml,” width=”830″>

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/install-docker-debian-03.png" data-lazy- height="504" src="data:image/svg xml,” width=”830″>

All the dependencies have been installed.

How to import Docker GPG key and repository on Debian 11

To sign the Docker packages, you have to import its official key into your system. For this, write out the curl command in the terminal.

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

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/install-docker-debian-04-e1633662710287.png" data-lazy- height="132" src="data:image/svg xml,” width=”830″>

Write out below-given command to add repository:

$ 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

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/install-docker-debian-05-e1633662857655.png" data-lazy- height="190" src="data:image/svg xml,” width=”830″>

For updating packages list use:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/install-docker-debian-06-e1633666266844.png" data-lazy- height="329" src="data:image/svg xml,” width=”830″>

After updating the packages list we can now move towards the next step.

How to install Docker on Debian 11

Now, execute this command for installing Docker on a Debian 11 system:

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

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/install-docker-debian-07.png" data-lazy- height="518" src="data:image/svg xml,” width=”830″>

Wait for a few minutes, as the Docker installation will take some time:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/install-docker-debian-08.png" data-lazy- height="516" src="data:image/svg xml,” width=”830″>

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/install-docker-debian-09.png" data-lazy- height="504" src="data:image/svg xml,” width=”830″>

If you want to confirm the existence of Docker on your system, then write out the “docker” command with the “-v” option. The “-v” option is added to show the version of the Docker:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/install-docker-debian-10-e1633667472472.png" data-lazy- height="128" src="data:image/svg xml,” width=”830″>

How to check Docker service on Debian 11

After successfully installing Docker on your system, the next step is to check its status using the “systemctl” command. The “systemctl” command is utilized to control different services in a system. In our case, we will execute the “systemctl” command with the “status” option to see if the Docker service is active or inactive on our Debian system:

$ sudo systemctl status docker

As you can see, Docker service is active on our CentOS:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/install-docker-debian-11.png" data-lazy- height="532" src="data:image/svg xml,” width=”830″>

How to test Docker on Debian 11

Till this point, we have installed Docker and checked its status on our Debian system. Now, what should we do next? We will test the working of Docker by running a sample container. For instance, in the below-given command, we will try to run the “hello-world” global docker container:

$ sudo docker run hello-world

The output declares that Docker is working effortlessly on the system:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/install-docker-debian-12.png" data-lazy- height="618" src="data:image/svg xml,” width=”830″>

Conclusion

Docker is a software framework that is utilized for developing, testing, and deploying applications quickly. It organizes applications or packages into containers, including everything that your application requires to operate, such as system tools, libraries, code, and runtime. Docker permits you to deploy and scale apps in any environment swiftly. This write up showed how to install Docker on Debian. Moreover, we showed you the procedure for testing Docker on your Debian 11 system.

About the author

<img alt="" data-lazy-src="https://secure.gravatar.com/avatar/c73b74cd8044d2e9b300610f5af77d0b?s=112&r=g" data-lazy- height="112" src="data:image/svg xml,” width=”112″>

Sharqa Hameed

I am a Linux enthusiast, I love to read Every Linux blog on the internet. I hold masters degree in computer science and am passionate about learning and teaching.