Installing docker on Fedora 31

Dishant Pandya
Sep 20 · 2 min read

A few days ago Fedora 31 was released and we are all excited to try it out, you can install docker-ce on it by simple following the steps given in docker documention, or by following the steps given below. But even after the installation running the docker container will throw some error as follows:

docker run --rm -it alpine sh
docker: Error response from daemon: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:297: applying cgroup configuration for process caused \"open /sys/fs/cgroup/docker/cpuset.cpus.effective: no such file or directory\"": unknown.

This is beacaue Fedora 31 uses cgroups v2 by default and docker doesn’t yet support cgroupsv2, which may be added soon as docker is most used container runtime. In this tutorial I am going to show you how to install docker and change cgroups to v1 as a quick fix to run docker. So Let’s go.

  1. Add Docker repo.
sudo dnf config-manager \
--add-repo \
https://download.docker.com/linux/fedora/docker-ce.repo

2. Install docker.

sudo dnf -y install docker-ce

this will install docker-ce and all its dependencies

Optionally , configure docker to be run by non-root user.

sudo groupadd dockersudo usermod -aG docker $USER

3. Change Kernel Boot Options.

Open default grub config.

sudo gedit /etc/default/grub

Now in to the line starting with GRUB_CMDLINE_LINUX, add the parameter systemd.unified_cgroup_hierarchy=0 as shown below and save it.

Now update the grub by running grub2-mkconfig, and reboot the system on success.

sudo grub2-mkconfig
reboot

And now you have docker installed and running on your Fedora 31.

Thank you.

Dishant Pandya

Written by

Curious about Tech and Producing Electronic Music

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade