Saturday, 8 November 2025

Docker - How to install docker in Redhat Linux

In Linux, you have the choice between installing Docker Engine or Docker Desktop.

The choice depends primarily on your needs and whether you prefer a minimalist CLI-focused approach (Engine) or a feature-rich GUI-focused approach (Desktop).

The key difference is below 













Follow below step to install Docker engine in Redhat linux.

https://docs.docker.com/engine/install/rhel/

[root@devopsvm01 ~]# cat /etc/os-release  | head -2

NAME="Oracle Linux Server"

VERSION="9.6"

[root@devopsvm01 ~]#


Set up the repository

Before you install Docker Engine for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository.

Install the dnf-plugins-core package (which provides the commands to manage your DNF repositories) and set up the repository.

[root@devopsvm01 ~]# sudo dnf -y install dnf-plugins-core

Last metadata expiration check: 2:22:34 ago on Mon 03 Nov 2025 12:42:43 AM IST.

Package dnf-plugins-core-4.3.0-20.0.1.el9.noarch is already installed.

Dependencies resolved.

Nothing to do.

Complete!

[root@devopsvm01 ~]# sudo dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo

Adding repo from: https://download.docker.com/linux/rhel/docker-ce.repo

[root@devopsvm01 ~]#


Install the Docker latest packages.


[root@devopsvm01 ~]# sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Docker CE Stable - x86_64                                                                                           172 kB/s |  35 kB     00:00

Dependencies resolved.

====================================================================================================================================================

 Package                                      Architecture              Version                           Repository                           Size

====================================================================================================================================================

Installing:

 containerd.io                                x86_64                    1.7.29-1.el9                      docker-ce-stable                     46 M

 docker-buildx-plugin                         x86_64                    0.29.1-1.el9                      docker-ce-stable                     17 M

 docker-ce                                    x86_64                    3:28.5.2-1.el9                    docker-ce-stable                     21 M

 docker-ce-cli                                x86_64                    1:28.5.2-1.el9                    docker-ce-stable                    8.7 M

 docker-compose-plugin                        x86_64                    2.40.3-1.el9                      docker-ce-stable                     15 M

Installing weak dependencies:

 docker-ce-rootless-extras                    x86_64                    28.5.2-1.el9                      docker-ce-stable                    3.4 M


Transaction Summary

====================================================================================================================================================

Install  6 Packages


Total download size: 111 M

Installed size: 443 M

Is this ok [y/N]: y

Downloading Packages:

(1/6): docker-buildx-plugin-0.29.1-1.el9.x86_64.rpm                                                                                              3.2 MB/s |  17 MB     00:05

(2/6): docker-ce-28.5.2-1.el9.x86_64.rpm                                                                                                                        3.7 MB/s |  21 MB     00:05

(3/6): docker-ce-rootless-extras-28.5.2-1.el9.x86_64.rpm                                                                                                               2.2 MB/s | 3.4 MB     00:01

(4/6): docker-ce-cli-28.5.2-1.el9.x86_64.rpm                                                                                                                           3.4 MB/s | 8.7 MB     00:02

(5/6): docker-compose-plugin-2.40.3-1.el9.x86_64.rpm                                                                                                                   4.0 MB/s |  15 MB     00:03

(6/6): containerd.io-1.7.29-1.el9.x86_64.rpm                                                                                                                           3.9 MB/s |  46 MB     00:11

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Total                                                                                                                                                                  9.3 MB/s | 111 MB     00:11

Docker CE Stable - x86_64                                                                                                                                               20 kB/s | 1.6 kB     00:00

Importing GPG key 0x621E9F35:

 Userid     : "Docker Release (CE rpm) <docker@docker.com>"

 Fingerprint: 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35

 From       : https://download.docker.com/linux/rhel/gpg

Is this ok [y/N]: y

Key imported successfully

Running transaction check

Transaction check succeeded.

Running transaction test

Transaction test succeeded.

Running transaction

  Preparing        :                                                                                                                                                                               1/1

  Installing       : docker-buildx-plugin-0.29.1-1.el9.x86_64                                                                                                                                      1/6

  Running scriptlet: docker-buildx-plugin-0.29.1-1.el9.x86_64                                                                                                                                      1/6

  Installing       : docker-compose-plugin-2.40.3-1.el9.x86_64                                                                                                                                     2/6

  Running scriptlet: docker-compose-plugin-2.40.3-1.el9.x86_64                                                                                                                                     2/6

  Installing       : docker-ce-cli-1:28.5.2-1.el9.x86_64                                                                                                                                           3/6

  Running scriptlet: docker-ce-cli-1:28.5.2-1.el9.x86_64                                                                                                                                           3/6

  Installing       : containerd.io-1.7.29-1.el9.x86_64                                                                                                                                             4/6

  Running scriptlet: containerd.io-1.7.29-1.el9.x86_64                                                                                                                                             4/6

  Installing       : docker-ce-rootless-extras-28.5.2-1.el9.x86_64                                                                                                                                 5/6

  Running scriptlet: docker-ce-rootless-extras-28.5.2-1.el9.x86_64                                                                                                                                 5/6

  Installing       : docker-ce-3:28.5.2-1.el9.x86_64                                                                                                                                               6/6

  Running scriptlet: docker-ce-3:28.5.2-1.el9.x86_64                                                                                                                                               6/6

  Verifying        : containerd.io-1.7.29-1.el9.x86_64                                                                                                                                             1/6

  Verifying        : docker-buildx-plugin-0.29.1-1.el9.x86_64                                                                                                                                      2/6

  Verifying        : docker-ce-3:28.5.2-1.el9.x86_64                                                                                                                                               3/6

  Verifying        : docker-ce-cli-1:28.5.2-1.el9.x86_64                                                                                                                                           4/6

  Verifying        : docker-ce-rootless-extras-28.5.2-1.el9.x86_64                                                                                                                                 5/6

  Verifying        : docker-compose-plugin-2.40.3-1.el9.x86_64                                                                                                                                     6/6

Installed:

  containerd.io-1.7.29-1.el9.x86_64         docker-buildx-plugin-0.29.1-1.el9.x86_64 docker-ce-3:28.5.2-1.el9.x86_64 docker-ce-cli-1:28.5.2-1.el9.x86_64 docker-ce-rootless-extras-28.5.2-1.el9.x86_64

  docker-compose-plugin-2.40.3-1.el9.x86_64

Complete!

[root@devopsvm01 ~]# 


Start Docker Engine.


[root@devopsvm01 ~]# sudo systemctl enable --now docker

Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.

[root@devopsvm01 ~]# ps -ef |grep -i dockerd

root      106275       1  0 03:06 ?        00:00:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

root      106619  105068  0 03:20 pts/0    00:00:00 grep --color=auto -i dockerd

[root@devopsvm01 ~]#


Verify docker version


[root@devopsvm01 ~]# docker --version

Docker version 28.5.2, build ecc6942

[root@devopsvm01 ~]#


Check Docker info


[root@devopsvm01 ~]# docker info

Client: Docker Engine - Community

 Version:    28.5.2

 Context:    default

 Debug Mode: false

 Plugins:

  buildx: Docker Buildx (Docker Inc.)

    Version:  v0.29.1

    Path:     /usr/libexec/docker/cli-plugins/docker-buildx

  compose: Docker Compose (Docker Inc.)

    Version:  v2.40.3

    Path:     /usr/libexec/docker/cli-plugins/docker-compose


Server:

 Containers: 1

  Running: 0

  Paused: 0

  Stopped: 1

 Images: 1

 Server Version: 28.5.2

 Storage Driver: overlay2

  Backing Filesystem: xfs

  Supports d_type: true

  Using metacopy: false

  Native Overlay Diff: false

  userxattr: false

 Logging Driver: json-file

 Cgroup Driver: systemd

 Cgroup Version: 2

 Plugins:

  Volume: local

  Network: bridge host ipvlan macvlan null overlay

  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog

 CDI spec directories:

  /etc/cdi

  /var/run/cdi

 Swarm: inactive

 Runtimes: io.containerd.runc.v2 runc

 Default Runtime: runc

 Init Binary: docker-init

 containerd version: 442cb34bda9a6a0fed82a2ca7cade05c5c749582

 runc version: v1.3.3-0-gd842d771

 init version: de40ad0

 Security Options:

  seccomp

   Profile: builtin

  cgroupns

 Kernel Version: 5.15.0-302.167.6.el9uek.x86_64

 Operating System: Oracle Linux Server 9.6

 OSType: linux

 Architecture: x86_64

 CPUs: 1

 Total Memory: 1.476GiB

 Name: devopsvm01

 ID: 929c24d3-d395-405d-b9ff-1fa5de0cfd63

 Docker Root Dir: /var/lib/docker

 Debug Mode: false

 Experimental: false

 Insecure Registries:

  ::1/128

  127.0.0.0/8

 Live Restore Enabled: false

[root@devopsvm01 ~]#


Verify that the installation is successful by running the hello-world image:


This command downloads a test image and runs it in a container. When the container runs, it prints a confirmation message and exits.

[root@devopsvm01 ~]# sudo docker run hello-world

Unable to find image 'hello-world:latest' locally

latest: Pulling from library/hello-world

17eec7bbc9d7: Pull complete

Digest: sha256:56433a6be3fda188089fb548eae3d91df3ed0d6589f7c2656121b911198df065

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/

[root@devopsvm01 ~]#


Configure Docker to start on boot with systemd


[root@devopsvm01 ~]# sudo systemctl enable docker.service

[root@devopsvm01 ~]#

[root@devopsvm01 ~]# sudo systemctl enable containerd.service

Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service → /usr/lib/systemd/system/containerd.service.

[root@devopsvm01 ~]#



No comments:

Post a Comment

Building a Safer PostgreSQL CI/CD Pipeline with GitHub Actions: Dev → PR Review → Test Promotion

In my previous post, we explored a simple push-to-main deployment strategy . While functional, that model is not considered an industry best...