The latest release of the Red Hat Enterprise Linux distribution 8 does not officially support Docker. Red Hat has built its own tools, buildah and podman, which aim to be compatible with existing docker images and work without relying on a daemon, allowing the creation of containers as normal users, without the need of special permissions (with some limitations: e.g. at the moment of writing, it's still not possible to map host ports to the container without privileges).

Some specific tools, however, are still missing: an equivalent of docker-compose, for example does not exists yet. In this tutorial we will see how to install and run the original Docker CE on Rhel8 by using the official Docker repository for CentOS7.

In this tutorial you will learn:
  • How to enable the docker-ce repository on Rhel8
  • How to install docker and docker-compose on Rhel8
Docker installed on Rhel8

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Red Hat Enterprise Linux 8
Software Docker version 18.09.2
Other Permission to run command with root privileges.
Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ - requires given linux commands to be executed as a regular non-privileged user

What is Docker?

Docker is an open source project which allows the creation and distribution of applications inside containers, which are standardized environments that can be easily replicated, independently from the host system. While in Red Hat Enterprise Linux 7 Docker was officially supported, on the new release of this open source operating system, it has been replaced by a series of other tools developed by Red Hat itself: buildah and podman. By the use of an external repository, however, it's still possible to install Docker CE (Community Edition): in this tutorial we will see how to perform such installation.

Adding the external repository

Since Docker is not available on Rhel8, we need to add an external repository to obtain the software. In this case we will use the official Docker CE CentOS7 repository: this is, at the moment of writing, the only way to install Docker CE on Red Hat Enterprise Linux 8.

The first thing we need to do is to install the yum-utils package which contains the yum-config-manager utility:

$ sudo yum install yum-utils

The yum-config-manager utility let us, among the other things, easily enable or disable a repository in our distribution. By default, only the appstream and baseos repositories are enabled on Rhel8; we need to add and enable also the docker-ce repo. All we need to do to accomplish this task, is to run the following command:

$ sudo yum-config-manager --add-repo

We can verify that the repository has been enabled, by looking at the output of the following command:

$ sudo yum repolist -v

The command above will return detailed information about all the enabled repositories. This is what you should see at this point:

Repo-id      : docker-ce-stable
Repo-name    : Docker CE Stable - x86_64
Repo-revision: 1549905809
Repo-updated : Mon 11 Feb 2019 06:23:29 PM CET
Repo-pkgs    : 30
Repo-size    : 618 M
Repo-baseurl :
Repo-expire  : 172,800 second(s) (last: Mon 18 Feb 2019 10:23:54 AM CET)
Repo-filename: /etc/yum.repos.d/docker-ce.repo

Repo-id      : rhel-8-for-x86_64-appstream-beta-rpms
Repo-name    : Red Hat Enterprise Linux 8 for x86_64 - AppStream Beta (RPMs)
Repo-revision: 1542158694
Repo-updated : Wed 14 Nov 2018 02:24:54 AM CET
Repo-pkgs    : 4,594
Repo-size    : 4.9 G
Repo-baseurl :
Repo-expire  : 86,400 second(s) (last: Mon 18 Feb 2019 10:23:55 AM CET)
Repo-filename: /etc/yum.repos.d/redhat.repo

Repo-id      : rhel-8-for-x86_64-baseos-beta-rpms
Repo-name    : Red Hat Enterprise Linux 8 for x86_64 - BaseOS Beta (RPMs)
Repo-revision: 1542158719
Repo-updated : Wed 14 Nov 2018 02:25:19 AM CET
Repo-pkgs    : 1,686
Repo-size    : 925 M
Repo-baseurl :
Repo-expire  : 86,400 second(s) (last: Mon 18 Feb 2019 10:23:56 AM CET)
Repo-filename: /etc/yum.repos.d/redhat.repo
Total packages: 6,310

Installing docker-ce

The docker-ce-stable repository is now enabled on our system. The repository contains several versions of the docker-ce package, to display all of them, we can run:

$ yum list docker-ce --showduplicates | sort -r
docker-ce.x86_64            3:18.09.2-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.1-3.el7                     docker-ce-stable
docker-ce.x86_64            3:18.09.0-3.el7                     docker-ce-stable
docker-ce.x86_64            18.06.2.ce-3.el7                    docker-ce-stable
docker-ce.x86_64            18.06.1.ce-3.el7                    docker-ce-stable
docker-ce.x86_64            18.06.0.ce-3.el7                    docker-ce-stable
docker-ce.x86_64            18.03.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            18.03.0.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.12.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.12.0.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.09.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.09.0.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.06.2.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.06.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.06.0.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.03.3.ce-1.el7                    docker-ce-stable
docker-ce.x86_64            17.03.2.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.03.1.ce-1.el7.centos             docker-ce-stable
docker-ce.x86_64            17.03.0.ce-1.el7.centos             docker-ce-stable

If we try to install docker-ce, the system will notify us of a broken dependency problem generated when trying to install the latest version of the software ( since this version requires >= 1.2.2-3, which seems to be not available, the 3.18.09-2 version will be automatically selected and installed instead:

$ sudo yum install docker-ce
Problem: package docker-ce-3:18.09.2-3.el7.x86_64 requires >= 1.2.2-3, but none of the providers can be installed
  - cannot install the best candidate for the job
  - package is excluded
  - package is excluded
 Package                           Arch        Version                             Repository                                  Size
 docker-ce                         x86_64      3:18.09.1-3.el7                     docker-ce-stable                            19 M
Installing dependencies:                     x86_64      1.2.0-3.el7                         docker-ce-stable                            22 M
 docker-ce-cli                     x86_64      1:18.09.2-3.el7                     docker-ce-stable                            14 M
 container-selinux                 noarch      2:2.73-3.el8+1838+91f7e486          rhel-8-for-x86_64-appstream-beta-rpms       42 k
 libtool-ltdl                      x86_64      2.4.6-25.el8                        rhel-8-for-x86_64-baseos-beta-rpms          58 k
 python3-policycoreutils           noarch      2.8-9.el8                           rhel-8-for-x86_64-baseos-beta-rpms         2.2 M
 python3-setools                   x86_64      4.1.1-11.el8                        rhel-8-for-x86_64-baseos-beta-rpms         446 k
 policycoreutils-python-utils      noarch      2.8-9.el8                           rhel-8-for-x86_64-baseos-beta-rpms         227 k
 python3-IPy                       noarch      0.81-22.el8                         rhel-8-for-x86_64-baseos-beta-rpms          43 k
 python3-libsemanage               x86_64      2.8-3.1.el8                         rhel-8-for-x86_64-baseos-beta-rpms         126 k
 python3-audit                     x86_64      3.0-0.5.20180831git0047a6c.el8      rhel-8-for-x86_64-baseos-beta-rpms          85 k
 libcgroup                         x86_64      0.41-19.el8                         rhel-8-for-x86_64-baseos-beta-rpms          70 k
 checkpolicy                       x86_64      2.8-1.el8                           rhel-8-for-x86_64-baseos-beta-rpms         337 k
 tar                               x86_64      2:1.30-4.el8                        rhel-8-for-x86_64-baseos-beta-rpms         838 k
Enabling module streams:
 container-tools                               1.0
Skipping packages with broken dependencies:
 docker-ce                         x86_64      3:18.09.2-3.el7                     docker-ce-stable                            19 M

Transaction Summary
Install  14 Packages
Skip      1 Package

Total download size: 59 M
Installed size: 248 M
Is this ok [y/N]:

As soon as we confirm the installation, the package and its dependencies will be downloaded and installed on our system.

Start and enable the docker daemon

Once docker-ce is installed, we must start and enable the docker daemon, so that it will be also launched automatically at boot. The command we need to run is the following:

$ sudo systemctl enable --now docker

At this point, we can confirm that the daemon is active by running:

$ systemctl is-active docker

Similarly, we can check that it is enabled at boot, by running:

$ systemctl is-enabled docker

Installing docker-compose

Docker compose is a very useful package which let us manage multi-container applications, like for example those based on the LAMP stack, where each part of the environment (PHP, Apache, MariaDB) is provided by a dedicated container (if you are interested in the subject, take a look at our tutorial about creating a docker-based lamp stack). The package is not available on Rhel8, nor an equivalent exists to be used with the Rhel tools. It's, however, possible to install it in many ways: just keep on reading and decide what suits you best.

Global installation

The way we should install docker-compose varies depending on whether we want to install it globally or just for a single user. At the moment of writing, the only way to install it globally is to download the binary from the github page of the project:

$ curl -L "$(uname -s)-$(uname -m)" -o docker-compose

Once the binary is downloaded, we move it into /usr/local/bin and we make it executable:

$ sudo mv docker-compose /usr/local/bin && sudo chmod +x /usr/local/bin/docker-compose

The /usr/local hierarchy is not chosen randomly. This directory structure is made to be used for files installed by the local administrator manually (for software compiled from source, for example), in order to ensure separation from the software installed with the system package manager.

Although it's possible for a normal user to run docker-related commands if he is part of the docker group (the group is automatically created when we install docker-ce), by default they must be executed with root privileges for security reasons. When we need to do the latter, since the /usr/local/bin directory is not in the root user's PATH, we either need to call the binary specifying its location or add /usr/local/bin to the PATH itself. The first option is the one which I recommend in this case.

Per-user installation

If our user is part of the docker group, and thus it is allowed to run docker commands, and since docker-compose is available as a python package, we can also install it using pip, the python package manager. First, make sure pip itself is installed:

$ sudo yum install python3-pip

To obtain docker-compose we run:

$ pip3.6 install docker-compose --user

Please notice that even if would be possible to run pip as root to install a package globally, this is not recommended and highly discouraged.

Testing docker

We installed docker and docker-compose, now to check that everything works as expected, we can try to build an image and run a container: in this case we will use the official httpd one. All we have to do is to launch the following command:

sudo docker run --rm --name=linuxconfig-test -p 80:80 httpd

Since the httpd image does not exists locally it will be automatically fetched and built. Finally, a container based on it will be launched in the foreground (it will be automatically removed when stopped). If our firewall is configured to allow access to port 80, we should be able to see the It works! message when we reach our machine ip via browser.


Red Hat Enterprise Linux 8 does not support Docker: on this distribution it has been replaced by Red Hat own tools like buildah and podman, which are compatible with Docker but don't need a server/client architecture to run. Using native tools, where possibile, is always the recommended way to go, but for a reason or another you may still want to install the original Docker.

In this tutorial, we saw how it is possible to install Docker CE on Rhel8, by using the official Docker repository for CentOS7, which is a 100% compatible clone. This is not an ideal solution, but it does work correctly, and, at the moment, is the only possible workaround to use Docker Community Edition on Rhel8.

Submit your RESUME, create a JOB ALERT or subscribe to RSS feed on
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in:

Comments and Discussions