DEV Community

Cover image for How To Install Docker on Red Hat
Nader Elshehabi
Nader Elshehabi

Posted on

How To Install Docker on Red Hat

I needed to install Docker on a Red Hat server. I know Red Hat recommends Podman, but honestly I didn't prefer the switch. I'm just used to docker and it works for me, besides; nothing -at least at the time of writing this article- matches Docker Swarm or docker compose using Podman.

My main challenge was that the server was on an internal only network in my organization with no direct access to internet. I couldn't simply install it using yum from Docker repo online. I had to install things manually.

The method below would also work if you can't directly install Docker on your Red Hat / Debian / CentOS for any reason. I simply followed the official docker guide and used the package for CentOS, and it works just fine. However, there is just one gotcha along the way.

You can start here using the official Docker guide on how to install from RPM package files.

Just visit the following link and download the latest version of each of the four packages:

  1. containerd.io-{VERSION}.el8.x86_64.rpm
  2. docker-ce-{VERSION}.el8.x86_64.rpm
  3. docker-ce-cli-{VERSION}.el8.x86_64.rpm
  4. docker-ce-rootless-extras-{VERSION}.el8.x86_64.rpm

In my case I couldn't use wget to download the packages directly to my server. I had to download them to my local laptop, then transfer them to my Red Hat server using scp. I created a folder under temp for the installation packages.

scp package.rpm remote_username@10.10.0.10:/temp/docker
Enter fullscreen mode Exit fullscreen mode

After the packages are in the remote directory, you simply need to run yum to install the packages. However, you must install all packages with ONE command:

sudo yum install docker-ce-<VERSION_STRING>.rpm docker-ce-cli-<VERSION_STRING>.rpm docker-ce-rootless-extras-<VERSION_STRING>.rpm containerd<VERSION_STRING>.rpm
Enter fullscreen mode Exit fullscreen mode

This is not mentioned in the documentation, and if you try to install them one by one, yum can't figure out dependencies offline.

Once here, you just need to start docker:

sudo systemctl start docker
Enter fullscreen mode Exit fullscreen mode

Congrats. If you didn't get any glaring ERROR messages, you should have docker happily running on your Red hat server! :)

Top comments (0)