Installing docker on Fedora 31
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.
- Add Docker repo.
sudo dnf config-manager \
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.
And now you have docker installed and running on your Fedora 31.