How to Install Docker On Debian 10

What is docker?

Docker is basically a container engine which uses the Linux Kernel in order to create the containers on top of an operating system. Which is use to create, deploy and run the applications.

Install Docker

apt install docker.io

To start and enable docker.

systemctl enable --now docker

To check Docker service.

systemctl status docker

Output:

[email protected]:~# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: e
   Active: active (running) since Fri 2021-06-04 13:39:50 EDT; 18s ago
     Docs: https://docs.docker.com
 Main PID: 9606 (dockerd)
    Tasks: 21
   Memory: 55.1M
   CGroup: /system.slice/docker.service
           ├─9606 /usr/sbin/dockerd -H fd://
           └─9613 docker-containerd --config /var/run/docker/containerd/containe

Jun 04 13:39:49 vps.server.com dockerd[9606]: time="2021-06-04T13:39:49.53777919

Create the docker group.

sudo groupadd docker

Add user to the docker group.

sudo usermod -aG docker $USER

If you want to add a different user, replace $USER with username.

To check docker version.

docker --version

Ouput:

[email protected]:~# docker --version
Docker version 18.09.1, build 4c52b90

Test docker using the hello-world container.

docker run hello-world

Output:

[email protected]:~# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete
Digest: sha256:5122f6204b6a3596e048758cabba3c46b1c937a46b5be6225b835d091b90e46c
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.
    (amd64)
 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:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

Done!