How to Install Docker on Rocky Linux 8

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 applications in a containerized environment.

First, check and install any pending system updates.

yum update 

Adding Docker repository

Enable the Docker CE repository by running the following command.

dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo

Output:

[root@vps ~]# dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
Adding repo from: https://download.docker.com/linux/centos/docker-ce.repo

Installing Docker-ce package

Install Docker-ce package on AlmaLinux 8 by running the following command.

dnf -y  install docker-ce --nobest

Output:

[root@server ~]# dnf -y  install docker-ce --nobest
Docker CE Stable - x86_64                        50 kB/s |  12 kB     00:00
Dependencies resolved.
================================================================================
 Package                      Arch   Version             Repository        Size
================================================================================
Installing:
 docker-ce                    x86_64 3:20.10.6-3.el8     docker-ce-stable  27 M
Installing dependencies:
 checkpolicy                  x86_64 2.9-1.el8           baseos           345 k
 container-selinux            noarch 2:2.155.0-1.module+el8.3.0+161+9c4b50ff
                                                         appstream         50 k
 containerd.io                x86_64 1.4.4-3.1.el8       docker-ce-stable  33 M
 docker-ce-cli                x86_64 1:20.10.6-3.el8     docker-ce-stable  33 M

Enable the Docker service.

systemctl enable --now docker

Output:

[root@vps ~]# systemctl enable --now docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.

Checking the Docker service

To verify the Docker service by running the following command.

systemctl status  docker

Output:

 [root@server ~]# systemctl status  docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor pres>
   Active: active (running) since Wed 2021-05-12 16:05:02 EDT; 11s ago
     Docs: https://docs.docker.com
 Main PID: 12504 (dockerd)
    Tasks: 8
   Memory: 44.1M
   CGroup: /system.slice/docker.service
           └─12504 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/conta>

May 12 16:04:59 server dockerd[12504]: time="2021-05-12T16:04:59.724605461-04:0>
May 12 16:04:59 server dockerd[12504]: time="2021-05-12T16:04:59.724671035-04:0>
May 12 16:04:59 server dockerd[12504]: time="2021-05-12T16:04:59.726331220-04:0>