Installing Docker on Fedora 31

Uninstall old versions
Older versions of Docker were called docker or docker-engine. If these are installed, uninstall them, along with associated dependencies.

$ sudo dnf remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine

SET UP THE REPOSITORY
Install the dnf-plugins-core package which provides the commands to manage your DNF repositories from the command line.

$ sudo dnf -y install dnf-plugins-core

Use the following command to set up the stable repository.

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


INSTALL DOCKER ENGINE - COMMUNITY
Install the latest version of Docker Engine - Community and containerd, or go to the next step to install a specific version:

$ sudo dnf install docker-ce docker-ce-cli containerd.io

If prompted to accept the GPG key, verify that the fingerprint matches 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35, and if so, accept it.

Cgroups Exception For Fedora 31, you’ll have to enable the backwards compatibility for Cgroups.

$ sudo grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0"

Start Docker

$ sudo systemctl start docker

Enable Docker for startup

$ sudo systemctl enable docker

RESTART Linux

Verify that Docker Engine - Community is installed correctly by running the hello-world image.

$ sudo docker run hello-world

Source: https://docs.docker.com/install/linux/docker-ce/fedora/