How to install Docker on Red Hat Enterprise Linux 8

You can install Docker on Red Hat either via a repository or manually. Only a few steps are required for both options.

How to install Docker on Red Hat 8

First released in 2013, Docker is a free software that has become one of the top container solutions for development and system administration. It enables users to deploy and run applications within Docker containers, allowing for faster usage by including necessary dependencies. Docker is highly recommended, particularly when used with Red Hat Enterprise Linux (RHEL). RHEL is known as one of the most popular and reliable Linux distributions for businesses, praised for its stability, security, and high compatibility with a wide range of software packages. Below, we will guide you through the process of installing Docker on RHEL 8.

Tip

Are you using a newer version of the Linux platform? In our Digital Guide you will also find instructions on how to install Docker on RHEL 9.

What requirements must be met?

Before you start installing Docker on Red Hat Enterprise Linux 8, there are some prerequisites that need to be fulfilled. You need a virtual machine with RHEL 8 installed on it and you can find out how this works in our Digital Guide. You must also have admin privileges for this machine. It is also important that you have an internet connection so that you can download the necessary packages. Once these requirements have been met, you can start installing Docker on RHEL 8.

Steps for installing Docker on Red Hat Enterprise Linux 8

We explain how to add Docker via the corresponding repository. We recommend this method as this makes installation and future updates easier.

Remove old versions of Docker

You only need to perform the first step if there is already an older version of Docker on the system. In this case, you should delete all dependencies as well as this version. The package manager Podman will also be removed. You will need the following code 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

Yum is the package management system YUM (Yellowdog Updater, Modified).

Bring the system up to date

The first step you should always take is to update your entire system. To do this, open a terminal and use the update command to update all files and dependencies so you have the latest version. This is the appropriate command for this:

yum update
bash

Create repository

You will need to set up a repository for Docker, which is necessary for the installation process. Begin by installing the yum-utils package, as it includes the configuration manager for yum. Once that’s done, you can create the repository using the following commands:

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

Carry out installation

Now, starting from the new repository, you can begin the actual Docker installation on Red Hat Enterprise Linux 8. To add the current version of the engine, conainerd (a runtime environment) and the orchestration tool Docker Compose, enter this command:

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

If you’re asked for the GPG key, it is as follows:

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

Check it and confirm if there is a match.

If you want to install a specific version of Docker on RHEL 8 instead, first display all available options from the repository. This looks something 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

Select the desired version and replace the placeholder ‘version_name’ in the following command with the corresponding name. This always consists of the name of the package (docker-ce), a hyphen and the version number. An example would be this variant: docker-ce-3:24.0.0-1.e18. The command reads like this:

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

Check Docker

To check whether the installation of Docker on Red Hat Enterprise Linux 8 was successful, you should now start the platform. To do this, use this command:

sudo systemctl start docker
bash

Then initiate a ‘hello-world’ Docker image to test the functionality of the platform. The following command can be used for this:

sudo docker run hello-world
bash

How to manually install Docker on RHEL 8

If you do not have access to a repository, manual installation is also possible. The steps required for this are as follows:

Remove old versions of Docker

If you still have an old version of Docker on Red Hat Enterprise Linux 8, you should delete it first. This is the corresponding code:

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

You will receive a notification if there is no previous version stored.

Download rpm file

Now go to the official Docker download page and select the appropriate variant for RHEL 8. Then download the corresponding rpm file.

Start installation

To install Docker on RHEL 8, use the command below. Be sure to replace path/to/your/package with the actual path where the file is stored.

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

Check installation

To check whether the installation was successful, start Docker again using the following command:

sudo systemctl start docker
bash

Now run the ‘hello-world’ Docker image to check its functionality:

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