After taking a walk at the park wearing my new Irregular bucket hat I got a call from a customer wanting to install Docker on Red Hat 8. I have installed Docker on Ubuntu and macOS, but never on Red Hat. I found something right away in the Docker’s documentation site:

We currently only provide packages for RHEL on s390x (IBM Z). Other architectures are not yet supported for RHEL, but you may be able to install the CentOS packages on RHEL. Refer to the Install Docker Engine on CentOS page for details.

I said shit! But, after reading the last sentence I got some hope back. I really don’t understand why Docker doesn’t support on x86_64 architecture.

Then I decided to follow the CentOS installation way by setting up the repository:

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

I ran yum to install the latest Docker version:

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

You might be prompted to accept the GPG key. If so, go ahead and accept it.

Now Docker is installed, but NOT running. You need to start it:

sudo systemctl start docker

Next, verify Docker engine installation is running:

sudo docker run hello-world

The above command downloads a test image and run it in a container. You should see something like this:

Install Docker Red Hat 8

This means Docker has been successfully installed on Red Hat 8. Great that instructions for CentOS worked!

Now, if you like to run Docker without ‘sudo’. Follow the below steps:

sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker (this is to force group changes)

If you don’t run newgrp command then you will need logoff and login for changes to take effect.

Verify again without using sudo:

docker run hello-world

The above command should do the same as before. Contact me if you get errors.

If you like to configure Docker to start on boot with systemd do the following:

sudo systemctl enable docker.servicesudo 
systemctl enable containerd.service

You should see the output:

Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service → /usr/lib/systemd/system/containerd.service.

If you like to stop the above do the opposite:

sudo systemctl disable docker.service
sudo systemctl disable containerd.service

If you need to change logging drivers read this documentation.

Remember to check my shop. I design cool T-Shirts and coffee mugs. Thanks!

Leave a comment

Your email address will not be published. Required fields are marked *