How to install Docker on Red Hat Enterprise Linux 9

You have two options for installing Docker on Red Hat Enterprise Linux 9. Although creating a repository is recommended, manual installation is also possible.

How to install Docker on Red Hat 9

Docker’s open platform simplifies development across multiple locations or machines and facilitates seamless team collaboration. Because applications and their dependencies can be sent and executed together in Docker containers, performance is also massively improved. A popular combination is Docker with Red Hat Enterprise Linux 9. The proprietary Linux distribution is now regarded as one of the most robust, secure and flexible solutions specifically for companies. Its compatibility with numerous software packages also speaks in favour of the platform. We explain how to install Docker on Red Hat Enterprise Linux (RHEL).

Tip

In our Digital Guide you will also find comprehensive instructions for installing Docker on RHEL 8.

What requirements must be met?

To install Docker on RHEL 9, you need to take a few preliminary steps. First, ensure you have a virtual machine running the appropriate version of Red Hat Enterprise Linux. Our Digital Guide provides instructions on how to install RHEL 9. You’ll also need administrator privileges for this virtual machine. Additionally, a stable internet connection is essential for downloading all the required packages. Once these conditions are met, you can proceed with the installation.

Steps for installing Docker on Red Hat Enterprise Linux 9

The simplest way to install Docker on Red Hat Enterprise Linux 9 is through an rpm repository. Begin by setting up this repository and then proceed with the following steps. We recommend this approach, as it also simplifies future updates. Here’s the process:

Remove old versions of Docker

Before installing a new version of Docker, it’s important to uninstall any older versions along with all related dependencies. This process will also remove the package manager Podman. Afterward, you’ll use the YUM (Yellowdog Updater, Modified) package management system for the necessary steps. The code for this process is as follows:

sudo yum remove docker \
    docker-client \
    docker-client-latest \
    docker-common \
    docker-latest \
    docker-latest-logrotate \
    docker-logrotate \
    docker-engine \
    podman \
    runc
bash

If no old versions can be found, YUM will inform you.

Update system

Before you carry out the installation, it makes sense to update your entire system first. This will ensure that all files and dependencies are up to date. This instruction can be used for this purpose:

yum update
bash

Create repository

The installation is carried out via a repository. If you want to create this directory, you will need the yum-utils package, which contains the YUM configuration manager. Use the following two command lines to install yum-utils, start the manager and create a new repository for Docker on RHEL 9:

sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
bash

Install current version or any version

To install the latest version of Docker on Red Hat Enterprise Linux 9, use the following command. This will install the Docker engine along with the containerd runtime and the Docker Compose orchestration tool.

sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
bash

In some cases, you will be asked for the GPG key. Compare the stored key with this combination of numbers. If both match, confirm that they are correct.

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

If you want to use a specific version of Docker for RHEL 9, you can view a list of all available options from the repository and select the version that suits your needs. An example of such a list looks like this:

yum list docker-ce --showduplicates | sort -r
docker-ce.s390x    3:24.0.0-1.el8    docker-ce-stable
docker-ce.s390x    3:23.0.6-1.el8    docker-ce-stable
<...>
bash

Decide on the desired version and enter the full version name in the following command instead of the placeholder ‘version_name’. These names are always structured according to the same principle: Name of the package (in this case ‘docker-ce’), then a hyphen and followed by the version number. For the first option from the list above, this would be the correct name: docker-ce-3:24.0.0-1.el8.

sudo yum install docker-ce-version_name docker-ce-cli-version_name containerd.io docker-buildx-plugin docker-compose-plugin
bash

Check Docker

To ensure that the installation of Docker on Red Hat Enterprise Linux 9 was successful, start the platform with this command:

sudo systemctl start docker
bash

Then create the Docker image ‘hello-world’. If this works as expected, the installation was successful.

sudo docker run hello-world
bash

How to install Docker on RHEL 9 manually

There is also the option of installing Docker on RHEL 9 without creating a repository.

Remove all old versions of Docker on RHEL 9

First, delete all old versions of Docker on Red Hat Enterprise Linux 9 and the package manager Podman. This code could be used for this:

sudo yum remove docker \
    docker-client \
    docker-client-latest \
    docker-common \
    docker-latest \
    docker-latest-logrotate \
    docker-logrotate \
    docker-engine \
    podman \
    runc
bash

Download rpm file

Go to the official Docker download page and download the desired rpm file.

Start installation

To start the installation of Docker on Red Hat Enterprise Linux 9, use the following command. Instead of the placeholder ‘path/to/your/package’, enter the location of the rpm file.

sudo yum install /path/to/your/package.rpm
bash

Check installation

When the installation is complete, start Docker with this command:

sudo systemctl start docker
bash

Create the ‘hello-world’ Docker image. If this works, it means that the installation was successful.

sudo docker run hello-world
bash
Compute Engine
The ideal IaaS for your workload
  • Cost-effective vCPUs and powerful dedicated cores
  • Flexibility with no minimum contract
  • 24/7 expert support included
Was this article helpful?
Page top