What do we need to Install Docker on RHEL 8?

If you are wondering is Docker supported on RHEL? Then the answer is YES. Red Hat Enterprise Linux 8 does support this container-based service. Although Podman is a popular alternative to this, users can still manually install Docker.  In this article, we learn the steps to install the Docker engine on RedHat using the command terminal.

Things we require to perform this tutorial.

  • Of course, RHEL OS
  • A non-root user with sudo rights
  • Internet connection
  • Virtualization support

Installing Docker on RHEL 8 Linux

The Docker packages are not shipped with RedHat Linux and are not supported by it. Because the docker container engine has been replaced by RHEL’s own set of Container-tools. You can know about it on the doc page of RHEL. Hence, if you want to install Docker of Redhat 8 then here are the steps to follow:

1. Remove Container tools

The problem user is facing while installing Docker on RHEL 8 is the package conflict. Yes, the container service is already occupied by the podman and its helping tool such as buildah, cockpit-podman. Hence, first, we run a single command that will remove all of them.

sudo dnf remove runc

Note: The above command will also uninstall the dependencies that will again install with Docker.


Updating Subscription Management repositories.
Last metadata expiration check: 0:03:21 ago on Mon 19 Dec 2022 06:04:45 AM EST.
============================================== Name Exactly Matched: runc ==============================================runc.x86_64 : CLI for running Open Containers
[h2s@localhost ~]$ sudo dnf remove runc
Updating Subscription Management repositories.
Dependencies resolved.
======================================================================================================================== Package              Arch     Version                                        Repository                           Size
 runc                 x86_64   1:1.1.4-1.module+el8.7.0+17064+3b31f55c        @rhel-8-for-x86_64-appstream-rpms   9.5 M
Removing dependent packages:
 buildah              x86_64   1:1.27.2-2.module+el8.7.0+17064+3b31f55c       @rhel-8-for-x86_64-appstream-rpms    26 M
 cockpit-podman       noarch   53-1.module+el8.7.0+17064+3b31f55c             @rhel-8-for-x86_64-appstream-rpms   548 k
 podman               x86_64   3:4.2.0-4.module+el8.7.0+17064+3b31f55c        @rhel-8-for-x86_64-appstream-rpms    41 M
Removing unused dependencies:
 conmon               x86_64   3:2.1.4-1.module+el8.7.0+17064+3b31f55c        @rhel-8-for-x86_64-appstream-rpms   172 k
 container-selinux    noarch   2:2.189.0-1.module+el8.7.0+17064+3b31f55c      @rhel-8-for-x86_64-appstream-rpms    57 k
 containers-common    x86_64   2:1-43.module+el8.7.0+17064+3b31f55c           @rhel-8-for-x86_64-appstream-rpms   406 k
 criu                 x86_64   3.15-3.module+el8.7.0+17064+3b31f55c           @rhel-8-for-x86_64-appstream-rpms   1.4 M
 fuse-overlayfs       x86_64   1.9-1.module+el8.7.0+17064+3b31f55c            @rhel-8-for-x86_64-appstream-rpms   145 k
 fuse3                x86_64   3.3.0-16.el8                                   @rhel-8-for-x86_64-baseos-rpms      100 k
 fuse3-libs           x86_64   3.3.0-16.el8                                   @rhel-8-for-x86_64-baseos-rpms      274 k
 libnet               x86_64   1.1.6-15.el8                                   @rhel-8-for-x86_64-appstream-rpms   166 k
 libslirp             x86_64   4.4.0-1.module+el8.7.0+17064+3b31f55c          @rhel-8-for-x86_64-appstream-rpms   134 k
 podman-catatonit     x86_64   3:4.2.0-4.module+el8.7.0+17064+3b31f55c        @rhel-8-for-x86_64-appstream-rpms   764 k
 shadow-utils-subid   x86_64   2:4.6-17.el8                                   @rhel-8-for-x86_64-baseos-rpms      205 k
 slirp4netns          x86_64   1.2.0-2.module+el8.7.0+17064+3b31f55c          @rhel-8-for-x86_64-appstream-rpms   103 k

2. Enable the Docker package source

As we know RedHat 8 base repository doesn’t supply the packages to install Docker. So, let’s use the given command and add the repository we need, manually. This will help us to get the install latest stable version of the docker available version of it.

sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo

3. Update RHEL 8

To flush the DNF package index cache and rebuild it again, so that it could recognize the added Docker repository- run the system update.

sudo dnf update

4. Install Docker on RedHat 8.7

We have removed the Podman and also have added the required repository for Docker Engine and compose. Now, let’s use the DNF package manager to install the docker CE container service with the satisfiable dependencies we are talking about.

sudo dnf install docker-ce docker-ce-cli containerd.io
Install Docker on Redhat 8

5. Start and Enable the service

To use this container service command line, we must start its service using the systemctl command. This will mark it to run in the background and restart automatically with the system boot.

sudo systemctl enable docker
sudo systemctl start docker

To check the service status:

systemctl status docker --no-pager -l

To know the version of docker ce

docker --version
systemctl status docker service

6. Non-root Docker usage

Whenever we want to use the Docker command line, it will ask us to use either root or sudo to perform the tasks. To remove this obstacle, let’s add our current non-root user to Docker’s group.

sudo usermod -aG docker $USER

Reload Shell session

newgrp docker

7. Create a Container

Let’s test whether the Docker is working as we want to create containers by pulling the Images from its library or not. For that, here we are fetching the Ubuntu Image to create a container.

docker pull ubuntu

To check the image has been downloaded on the system, use:

docker images

Create a container:

docker run -it --name myfirst ubuntu

--name is a parameter to assign a name to the container and myfirst is the name we have used.

Test the container service on RHEL

Alternatively, those who want a Quick check can use the hello-world image as well:

docker run hello-world
docker run hello world

8. Uninstall and reinstall Podman

Well, if you think Docker is not the container service you want. And in case you want to install Podman on your Red Hat Enterprise Linux 8 again then run the following command:

Remove Docker

sudo dnf remove -y docker-ce docker-ce-cli containerd.io

Reinstall Podman and Runc

sudo dnf install podman cockpit-podman buildah

Other Articles:

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.