How To Install Docker on Debian 10 – Debian | Holhol24


Docker is a containerization software that helps to build, deploy, and run applications in a container. The containers are similar to virtual machines, but they consume fewer resource, easy to manage, and can run anywhere regardless of the operating environment it is running in.

In this post, we will see how to install Docker Comunity Edition (CE) on Debian 10.

Note: Docker requires a 64-bit version of Debian OS.

Install Docker on Debian 10

Remove Old Versions

Uninstall the older versions of Docker called docker or docker-engine along with dependencies from your system.

 sudo apt remove -y docker docker-engine containerd runc

Content of /var/lib/docker/ directory which holds Docker volumes, images, and networks are preserved.

Setup Docker Repository

Install the below packages to let apt have the support of https method.

sudo apt update

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

Add the GPG key of Docker repository on your system.


sudo apt-key add gpg

Add the Docker repository to the system by running below command.

echo "deb [arch=amd64] $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list

Update the apt database.

sudo apt update

Run the below command to ensure you are installing Docker from the official repository, not from the default Debian repository.

sudo apt-cache madison docker-ce

You should see the output something like below.

 docker-ce | 5:19.03.1~3-0~debian-buster | buster/stable amd64 Packages
 docker-ce | 5:19.03.0~3-0~debian-buster | buster/stable amd64 Packages
 docker-ce | 5:18.09.8~3-0~debian-buster | buster/stable amd64 Packages
 docker-ce | 5:18.09.7~3-0~debian-buster | buster/stable amd64 Packages
 docker-ce | 5:18.09.6~3-0~debian-buster | buster/stable amd64 Packages
 docker-ce | 5:18.09.5~3-0~debian-buster | buster/stable amd64 Packages
 docker-ce | 5:18.09.4~3-0~debian-buster | buster/stable amd64 Packages
 docker-ce | 5:18.09.3~3-0~debian-buster | buster/stable amd64 Packages
 docker-ce | 5:18.09.2~3-0~debian-buster | buster/stable amd64 Packages
 docker-ce | 5:18.09.1~3-0~debian-buster | buster/stable amd64 Packages
 docker-ce | 5:18.09.0~3-0~debian-buster | buster/stable amd64 Packages
 docker-ce | 18.06.3~ce~3-0~debian | buster/stable amd64 Packages
 docker-ce | 18.06.2~ce~3-0~debian | buster/stable amd64 Packages

Install Docker

Install Docker using the apt command.

sudo apt install -y docker-ce docker-ce-cli

To install a specific version, use version string from the second column of the previous command like docker-ce= & docker-ce-cli=.

For example, 5:18.09.8~3-0~debian-buster.

sudo apt install -y docker-ce=5:18.09.8~3-0~debian-buster docker-ce-cli=5:18.09.8~3-0~debian-buster

Check the Docker version post the installation.

docker -v


Docker version 19.03.1, build 74b1e89

Docker service should now be up and running.

sudo systemctl status docker


Docker Service Status

Verify Docker Installation

To test the Docker installation, we will run the hello-world container.

sudo docker run hello-world

Below output confirms that you have correctly installed Docker on Debian OS.

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:6540fc08ee6e6b7b63468dc3317e3303aae178cb8a45ed3123180328bcc1d20f
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:

For more examples and ideas, visit:

Allow Non-root user to run Docker

By default, regular users do not have privileges to run Docker commands because Docker daemon uses Unix socket which is owned by the user root.

Privilege Issue
Privilege Issue

To overcome that, regular users use elevated access (sudo) to run Docker commands.

sudo docker run hello-world

If you want to allow regular users to run Docker containers without prefixing sudo, follow the below steps.

Create a group called docker if it does not exist.

sudo groupadd docker

Create a user if required. Replace holhol24 with your username.

sudo useradd -m -s /bin/bash holhol24

Add the user to the docker group.

sudo usermod -aG docker holhol24

Log out and log in back and then run Docker commands without prefixing sudo.

docker run hello-world

Interested Topics

Docker Basic Topics

1: Top Important Docker Commands – Working with Docker Containers

2: Working with Docker Images – Building Docker Images

3: How to Build Docker Images with DockerFile

Docker Advanced Topics

1: How to Setup Docker Private Registry on CentOS 7

2: How to Install and Configure Docker Swarm on CentOS 7


That’s All. Please share your feedback in the comments section.