How to Install Docker on Debian 10


If you are a computer enthusiast, it is highly likely that you’ve heard of containers and virtualized applications. These concepts, widely used in servers with constant production, have provided solutions to many major problems that began to happen as a result of the exponential growth of the Internet and web applications. Therefore, I will show you how to install Docker on Debian 10.

So, What is Docker?

According to the official Docker documentation:

“Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly”.

This may not be so easy to understand. So I will explain it to you in a simpler way. A large or small scale server application requires many dependencies, for example, a particular version of Java, a special database manager or different libraries. If the program was made on a system like CentOS 8, and the server where this application is going to be installed uses CentOS 8, then there will be no problems. However, if the program is to be installed on another system, it may not be possible to meet the requirements.

The above situation means that the developer will have to modify his application according to the system where it is to be installed. This is not convenient at all. This is where Docker comes in because with Docker you can create a container where all the program’s dependencies are. And then distribute it in the form of images that will run on any system that supports Docker. The brilliant thing about this is that these images work similarly to a virtual machine because they will really only share necessary resources with the real server such as a folder for the data, ports for the connections or various configurations.

The images are the way the containers are distributed which in the end are the applications and their dependencies are managed by the docker. This includes execution, stopping, and configuration of them.

So let us install the Docker on Debian 10. This will open the door to a world where you can get a lot out of it.

Getting Docker on Debian 10

Being such an important program within the server field, it is quite easy to think that it has a Linux version. But not only this, but it has support for the most popular Linux distributions like Ubuntu, Debian, CentOS, and RHEL.

At the same time, docker has versions for Windows and macOS but the full potential of docker is in Linux.

Because Docker has an open-source version called community, there is a special repository for Debian 10 Buster. I will use it to do the installation and keep it updated with little effort.

First, open a terminal session in Debian 10. In case Debian 10 is installed on a server, connect using SSH.

Then, in the terminal, make sure that Docker is not installed on the system. To do this, run the following command:

:~$ sudo apt-get remove docker docker-engine containerd runc
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'docker-engine' is not installed, so not removed
E: Unable to locate package containerd
Uninstall previous docker installation
Uninstall previous docker installation

Then you can install some packages that are necessary to add the Docker repository. These packages are usually already installed, but it is good to be sure.

:~$ sudo apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common
Reading package lists... Done
Building dependency tree       
Reading state information... Done
ca-certificates is already the newest version (20190110).
ca-certificates set to manually installed.
The following additional packages will be installed:
  dirmngr gir1.2-packagekitglib-1.0 gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm libappstream4 libassuan0 libcurl4
  libglib2.0-bin libgstreamer1.0-0 libksba8 libnpth0 libpackagekit-glib2-18 libstemmer0d packagekit packagekit-tools pinentry-curses python3-distro-info
  python3-software-properties unattended-upgrades
Suggested packages:
  pinentry-gnome3 tor parcimonie xloadimage scdaemon gstreamer1.0-tools appstream pinentry-doc bsd-mailx default-mta | mail-transport-agent needrestart
The following NEW packages will be installed:
  apt-transport-https curl dirmngr gir1.2-packagekitglib-1.0 gnupg gnupg-l10n gnupg-utils gnupg2 gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm
  libappstream4 libassuan0 libcurl4 libglib2.0-bin libgstreamer1.0-0 libksba8 libnpth0 libpackagekit-glib2-18 libstemmer0d packagekit packagekit-tools pinentry-curses
  python3-distro-info python3-software-properties software-properties-common unattended-upgrades
0 upgraded, 30 newly installed, 0 to remove and 0 not upgraded.
Need to get 11.6 MB of archives.
After this operation, 27.3 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Install some dependencies to install Docker
Install some dependencies to install Docker

After the packages have been installed, it is time to add the GPG key from the Docker repository. This lets the system know that it is a secure repository.

:~$ curl -fsSL | sudo apt-key add -

This process is quite fast.

Now it’s time to add the Docker repository to the list of what APT manages.

:~$ sudo add-apt-repository "deb [arch=amd64] buster stable"

This command does not generate any screen output.

The next step is to refresh APT to load the newly added repository.

:~$ sudo apt update

Then, you can install Docker on Debian 10 using the following command:

:~$ sudo apt install docker-ce docker-ce-cli
Install Docker on Debian 10
Install Docker on Debian 10

It will then start the download and then the installation.

Testing Docker with the Hello World image

Depending on your internet connection and server the download will take little time. During the installation, Debian will automatically start and enable the Docker service.

However, it is advisable to perform a test before using Docker.

From the official Docker documentation, they say that the best way to verify if the installation has been successful is to run the Hello world image.

To do this, you must run this command:

:~$ sudo docker run hello-world
Testing the docker installation
Testing the docker installation

As you can see in the image, everything has gone well and you can now use Docker for your projects.

Remember that Docker works as a service of the system. Therefore, if you want to stop its operation, use the following command:

:~$ sudo systemctl stop docker

Or if you want to start it up again:

:~$ sudo systemctl start docker

On the other hand, you may want to check the status of the service.

:~$ sudo systemctl status docker

Also, you can find out the installed version by running the following command:

:~$ docker -v
Docker version 19.03.8, build afacb8b7f0

Uninstall Docker on Debian 10

If you no longer want to have Docker on your system, for whatever reason, and you want to uninstall it completely, you have to execute the following commands:

:~$ sudo apt remove docker-engine containerd runc
:~$ sudo apt purge docker-ce

And finally, delete the directory with the data and images:

:~$ sudo rm -rf /var/lib/docker

This way there will be no trace of Docker.


Technologies arise to give answers to problems. In computer science, this premise is easily fulfilled. Well, Docker came to solve the deployment of applications on the servers. Something that benefits both developers and server administrators who see how an application has the same behavior in different systems. Can you imagine that a developer has to modify his application to make it compatible with each of the most popular Linux distributions? It’s not good.

With Docker, you can install, run, remove and manage containers that solve these and other problems. Also with a view to the security of the servers because they are caged in the container.

So now the turn is for you, and use Docker to get the most out of it.

Info: Docker website