coding code program compute coder develop developer development
Image: REDPIXEL/Adobe Stock

AlmaLinux is a Red Hat Enterprise Linux clone, which means it doesn’t ship with Docker installed. In fact, most RHEL-based distributions are now defaulting to Podman. Although Podman is a close drop-in for Docker, I still have a penchant for the original, so I prefer to use that technology over its replacement.

The problem is that installing Docker on an RHEL-based distribution isn’t exactly straightforward. It’s not hard, but without knowing the right steps or flags to use, you’ll find it almost impossible to get Docker installed.

SEE: Hiring kit: Back-end Developer (TechRepublic Premium)

Fortunately, I’ve taken one for the team and figured out how it can be done without too much stress. Let’s make it happen.

What you’ll need to install Docker on AlmaLinux

The only things you’ll need to make this work are a running instance of AlmaLinux 9 and a user with sudo privileges.

How to install Docker CE on AlmaLinux

Log in to your instance of AlmaLinux and make sure it’s updated with the command:

sudo dnf update

A word of warning — the update will take some time. Depending on how long it has been since the last update (and the speed of your network connection), give this process anywhere from 10 to 60 minutes. For me, it took around 30 minutes to complete.

Once the update finishes, you’ll then need to install the development tools, which come by way of a handy group. This installation can be done with the command:

sudo dnf groupinstall "Development Tools"

Again, this installation will take some time. It’s faster than the update, but expect to at least watch the output from the command for five or so minutes.

When that completes, you should probably reboot the server if the update included the kernel. When the reboot finishes, log back in and add the necessary Docker repository with the command:

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

With the repository added, we can now install Docker CE. However, this is where the trick comes into play. If you simply issue the command:

sudo dnf install docker-ce -y

The command will fail. Why? Because many of the Docker dependencies conflict with Podman and its dependencies. To get around that you have to install Docker CE while removing Podman and its associated packages at the same time. This is done with the command:

sudo dnf install docker-ce --allowerasing

After the above command completes, start and enable the Docker service with:

sudo systemctl enable --now docker

Finally, add your user to the docker group with the command:

sudo usermod -aG docker $USER

Log out and log back in.

You can test the new installation by pulling down the hello-world image with the command:

docker pull hello-world

Congratulations, you’ve just replaced Podman with Docker on AlmaLinux. Whether or not you should do this depends on whether you find Podman a worthy successor to Docker. If not, this is your best route outside of switching to an Ubuntu-based server distribution.

Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.