I recently stumbled upon troubles 1 trying to run Docker on a fresh CentOS 8 install. Here my notes to spare your (and my) time:

First things first, we need to install the required packages:

dnf install dnf-utils device-mapper-persistent-data lvm2 fuse-overlayfs wget

Add Docker Community Edition repository to our system:

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

Update dnf cache as follows:

dnf makecache

As there is no CentOS 8 version of containerd.io in the official CentOS repositories, we need to get (and install) the CentOS 7 rpm as follows:

dnf install -y https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm

Finally, let’s install Docker:

dnf install docker-ce docker-ce-cli 

Enable at boot and start the Docker service:

systemctl enable docker
systemctl start docker

Test it:

# docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

Great! Now let’s test it deeper:

# docker run -it alpine /bin/sh
Unable to find image 'alpine:latest' locally
latest: Pulling from library/alpine
df20fa9351a1: Pull complete 
Digest: sha256:185518070891758909c9f839cf4ca393ee977ac378609f700f60a771a2dfe321
Status: Downloaded newer image for alpine:latest
/ # ping google.de
     ping: google.de: Try again

Darn! The Alpine container can’t resolve any hostnames. It turns out we have to add the docker0 network interface to the trusted zone of firewalld:

firewall-cmd --permanent --zone=trusted --add-interface=docker0
firewall-cmd --reload

Test again:

# docker run -it alpine /bin/sh
/ # ping google.de -c1
PING google.de (172.217.17.131): 56 data bytes
64 bytes from 172.217.17.131: seq=0 ttl=113 time=15.494 ms

--- google.de ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 15.494/15.494/15.494 ms

Great, we fixed it!


  1. Namely unable to install containerd.io and unable to resolve dns names ↩︎