How to install Docker CE on CentOS 8

If you require Docker CE on CentOS, the steps for installation have changed for the eighth iteration of the platform.

How to install Docker CE on CentOS 8 If you require Docker CE on CentOS, the steps for installation have changed for the eighth iteration of the platform.

If your business's cloud depends on containerized applications, chances are Docker is used somewhere in your pipeline. You might even use CentOS as your server of choice. If that's the case, you should know that installing Docker CE on CentOS has gone through some changes for the latest iteration of the open source platform (CentOS 8). 

I want to walk you through the process of installing the community edition of Docker on CentOS 8. The steps aren't all that challenging, just different than what you're used to.

What you'll need

The only things you'll need are:

  • A working instance of CentOS 8
  • A user with sudo privileges

How to add the necessary Docker repository

We're going to be using the dnf config-manager utility to add the Docker repository. To do this, open a terminal window and issue the command:

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

How to locate an installable version of Docker CE

As of now, Red Hat has blocked the installation of docker-ce, so if you attempt to run the command sudo dnf install docker-ce, it will fail. Instead, you must install a specific version of Docker. To find out which versions are available, issue the command:

dnf list docker-ce --showduplicates | sort -r

From that list, we can see version docker-ce-3:18.09.1-3.el7 is available for installation. 

How to install Docker CE

To install that version, issue the command:

sudo dnf install docker-ce-3:18.09.1-3.el7

In order to force DNS resolution to work within Docker containers, the firewalld must be disabled. To do that, issue the command:

sudo systemctl disable firewalld

Next we'll start and enable the docker daemon with the command:

sudo systemctl enable --now docker

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

sudo usermod -aG docker $USER

Congratulations, you now have Docker CE running and ready to work on CentOS 8. Begin deploying those containerized applications.

Also see

centoshero.jpg

Image: CentOS