How to Install Docker on RHEL 9 (Step-by-Step Guide)

Hello readers, in this guide we will explain how to install Docker on RHEL 9 step by step. Docker comes in two editions, community and enterprise, in this post we will install community edition.

Docker is an open-source container platform which uses OS level virtualization to create and mange containers. Docker allows developers and coders to build and package their application inside the container.

System Requirements for Docker

  • Minimal Installed RHEL 9
  • Minimum 2CPUs or vCPUs
  • Minimum 2 GB RAM or more
  • Sudo user with admin privileges
  • Internet Connectivity

Without any further delay, lets jump into the docker installation steps.

1) Remove Podman & Buildah

This step is optional in case you have not installed podman on your system. If it is installed, then remove it using following dnf command.

$ sudo dnf remove -y podman buidah

2) Add Docker Repository on RHEL 9

Docker package is not available in the default repositories of RHEL 9, so for its installation add  its repository using beneath dnf command.

$ sudo dnf config-manager --add-repo

Next, verify docker repository, run

$ sudo dnf repolist

Add Docker Repository On RHEL9

Output above confirms that docker repository has been added successfully.

3) Install Docker on RHEL 9

After adding docker repository, we are good to proceed with docker installation. Run following dnf command.

$ sudo dnf install docker-ce docker-ce-cli docker-buildx-plugin docker-compose-plugin -y

Install Docker on RHEL 9

Above command will install latest version of Docker community edition. If you are looking for specific docker version, then run below command to list the versions.

$ sudo dnf list docker-ce --showduplicates | sort -r

Docker CE Versions for RHEL 9

In above output, second column is version-string. So, choose the version that you want to install and run below command.

$ sudo dnf install docker-ce-<version-string> docker-ce-cli-<version-string> docker-buildx-plugin docker-compose-plugin -y

4) Start and Enable Docker Service

Once docker and its dependencies are installed then start and enable its service using systemctl commands as shown below:

$ sudo systemctl start docker
$ sudo systemctl enable docker

Start Enable Docker Service on RHEL 9

To verify the docker service status, run

$ sudo systemctl status docker

Check Docker Service Status on RHEL 9

Next, add your local user to the docker group so that your user can run docker commands without sudo.

$ sudo usermod -aG docker $USER
$ newgrp docker
$ id

Add Local User To Docker Group

Now, try to run docker version command without sudo.

$ docker version

Docker Version Command Output

5) Test Docker Installation

To test whether docker installation is successful or not, run a container with hello-world image.

$ docker run hello-world

Docker Run Hello-World Image

Great, output confirms that our docker installation is successful as we can see the informational message.

That’s all from this post, we hope you have found it useful and informative. Feel free to post your queries and feedback in below comments section.

Also Read: 20 Useful Docker Command Examples in Linux

Share on:

I am a Cloud Consultant with over 15 years of experience in Linux, Kubernetes, cloud technologies (AWS, Azure, OpenStack), automation (Ansible, Terraform), and DevOps. I hold certifications like RHCA, CKA, CKAD, CKS, AWS, and Azure.

Leave a Comment