How to Install Docker On Ubuntu 20.04

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:

root@vps:~# systemctl status docker
● docker.service - Docker Application Container Engine
 Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset>
 Active: active (running) since Tue 2020-05-05 14:04:31 UTC; 31min ago
TriggeredBy: ● docker.socket
   Docs: https://docs.docker.com
 Main PID: 14334 (dockerd)
  Tasks: 11
 Memory: 50.1M
 CGroup: /system.slice/docker.service
         └─14334 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/con>
 lines 1-10/10 (END)

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:

root@vps:~# docker --version
Docker version 19.03.8, build afacb8b7f0

Test docker using the hello-world container.

docker run hello-world

Output:

root@vps:~# docker run hello-world

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/

CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS