How to Install Docker On Ubuntu 22.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 used to create, deploy and run the applications.

Install Docker

Install the docker using the apt package manager.

apt install

Start and enable docker

systemctl enable --now docker

Check Docker service

systemctl status docker


root@crown:~# systemctl status docker
● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-03-15 18:40:32 UTC; 1h 11min ago
TriggeredBy: ● docker.socket
   Main PID: 2561 (dockerd)
      Tasks: 9
     Memory: 39.9M
        CPU: 1.721s
     CGroup: /system.slice/docker.service

Create a group called docker,

groupadd docker

To add an user into the docker user group

usermod -aG docker $USER

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

Check docker version,

docker --version


root@crown:~# docker --version
Docker version 20.10.12, build 20.10.12-0ubuntu4

Test docker using the hello-world container.

docker run hello-world


root@crown:~# docker --version
Docker version 20.10.12, build 20.10.12-0ubuntu4
root@crown:~#  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.
 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: