How to Install Docker on AlmaLinux 9

Docker is a container engine that uses the Linux Kernel to create the containers on top of an operating system. Which is used to create, deploy and run the applications

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@server ~]# 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 the Docker-CE package

Install the Docker-CE package on AlmaLinux 9 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                                                      9.6 kB/s | 5.8 kB     00:00
Dependencies resolved.
===============================================================================================================
 Package                            Architecture    Version                    Repository                 Size
===============================================================================================================
Installing:
 docker-ce                          x86_64          3:20.10.16-3.el9           docker-ce-stable           21 M
Installing dependencies:
 container-selinux                  noarch          3:2.179.1-1.el9_0          appstream                  45 k
 containerd.io                      x86_64          1.6.4-3.1.el9              docker-ce-stable           32 M
 docker-ce-cli                      x86_64          1:20.10.16-3.el9           docker-ce-stable           29 M
 docker-ce-rootless-extras          x86_64          20.10.16-3.el9             docker-ce-stable          3.8 M
 fuse-common                        x86_64          3.10.2-5.el9               baseos                    8.0 k
 fuse-overlayfs                     x86_64          1.8.2-1.el9                appstream                  71 k
 fuse3                              x86_64          3.10.2-5.el9               appstream                  53 k
 fuse3-libs                         x86_64          3.10.2-5.el9               appstream                  91 k
 libslirp                           x86_64          4.4.0-7.el9                appstream                  68 k
 slirp4netns                        x86_64          1.1.12-4.el9               appstream                  44 k
 tar                                x86_64          2:1.34-3.el9               baseos                    880 k
Installing weak dependencies:
 docker-scan-plugin                 x86_64          0.17.0-3.el9               docker-ce-stable          3.6 M

Enable the Docker service.

systemctl enable --now docker

Output:

[root@server ~]# 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 is running, use 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 preset: disabled)
     Active: active (running) since Tue 2022-05-24 21:46:00 CEST; 22s ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 9099 (dockerd)
      Tasks: 7
     Memory: 34.0M
        CPU: 263ms
     CGroup: /system.slice/docker.service
             └─9099 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

DONE!