How to Install Docker on Debian 10 (Buster)

Docker is a daemon-based container run time environment. In other words we can say docker provides an environment where container images can be launched. In this article we will demonstrate how to install latest version of Docker CE on Debian 10.

Prerequisite for docker installation

  • Minimal Debian 10
  • sudo user with privileges
  • Stable Internet Connection

Let’s jump into the installation steps

Step 1) Update apt package Index and install docker dependencies

Login to your Debian 10 system and run following apt command to update apt package index,

linuxbuzz@docker:~$ sudo apt update

Install docker dependencies by running following apt command,

linuxbuzz@docker:~$ sudo apt -y install apt-transport-https ca-certificates curl gnupg software-properties-common

Note: In case you are not able to install above dependencies then make sure following default repositories are enabled and configured.

linuxbuzz@docker:~$ cat /etc/apt/sources.list
…
deb http://deb.debian.org/debian buster main
deb-src http://deb.debian.org/debian buster main

deb http://deb.debian.org/debian-security/ buster/updates main
deb-src http://deb.debian.org/debian-security/ buster/updates main

deb http://deb.debian.org/debian buster-updates main
deb-src http://deb.debian.org/debian buster-updates main
…

After adding the missing repository, run ‘apt update’ command.

Step 2) Configure Docker CE repository

Execute the beneath command to configure official docker repository,

linuxbuzz@docker:~$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
linuxbuzz@docker:~$

Add GPG key to docker repository, run

linuxbuzz@docker:~$ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
OK
linuxbuzz@docker:~$

Update apt packages index by running,

linuxbuzz@docker:~$ sudo apt update

Now, we are all set to install docker in the next step.

Step 3) Install docker using apt command

Run below apt command to install latest version of docker,

linuxbuzz@docker:~$ sudo apt -y install docker-ce docker-ce-cli containerd.io

Once docker package and its dependencies are installed, run systemctl command to verify the status its service,

linuxbuzz@docker:~$ sudo systemctl status docker

docker-service-status-debian10

Perfect, above output confirms that docker service is up and running.

Step 4) Test and Verify Docker Installation

If you wish to manage docker containers with your local user then add that user to docker group, in my case local user is linuxbuzz, run below usermod command:

linuxbuzz@docker:~$ sudo usermod -aG docker ${USER}

To make new group membership into the affect, either logout and log-in or run below su command,

linuxbuzz@docker:~$ su - ${USER}

Run ‘id -nG’ command to verify whether user is part of docker group,

linuxbuzz@docker:~$ id -nG
linuxbuzz cdrom floppy sudo audio dip video plugdev netdev bluetooth lpadmin scanner docker
linuxbuzz@docker:~$

To verify the docker installation, try to deploy hello-world container by running beneath commands

linuxbuzz@docker:~$ docker --version
Docker version 19.03.13, build 4484c46d9d
linuxbuzz@docker:~$
linuxbuzz@docker:~$ sudo docker run hello-world

Above command will spin up a container using a test image and when the container is provisioned properly then it will display the informational message and exited automatically.

Output:

docker-run-hello-world-debian10

That’s all from this tutorial, I hope these steps help you to install Docker on your Debian 10 system smoothly. For any queries and feedback, please drop comments in the below comments section.

Leave a Comment

14 − five =