Notes to self

Running Docker in Fedora 31

Fedora is a forward-thinking distribution and with the progress happening to Podman Fedora 31 switched to CGroupsV2.

Here is the summary of the change:

The kernel has had some support for CgroupsV2 for some time, and yet no one has used it because it is not on by default. There are lots of new features and fixes over CgroupsV1 that it is time to reveal to the user community.

While Docker does not work with CGroupsV1, Podman, compatible Docker replacement from the Red Hat folks does and is available.

What are even those cgroups you ask? Here’s a snippet from Wikipedia:

cgroups (abbreviated from control groups) is a Linux kernel feature that limits, accounts for, and isolates the resource usage (CPU, memory, disk I/O, network, etc.) of a collection of processes.

So cgroups are the thing that constrains the container resources on a Linux system (and kind of give them the meaning to exist…).

To install Podman just run dnf install podman as with any other package:

$ sudo dnf install podman

Done! Now start using podman instead of docker:

$ podman pull ...
$ podman ps

There are two more reasons to give Podman a go:

  • It’s daemon-less so you don’t need a running service to administer your Docker containers.
  • It does not require root privileges.

If for some reason Podman does not work for you, you need to downgrade to CGroupsV1 to continue with Docker CE as usual.

Edit /etc/default/grub as root and append to GRUB_CMDLINE_LINUX:

systemd.unified_cgroup_hierarchy=0

This is how /etc/default/grub file looks like on my system after the change:

GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=fedora/root rd.luks.uuid=luks-53d3010b-fd1b-4c42-9b83-a37cb8d6db8a rd.lvm.lv=fedora/swap rhgb quiet systemd.unified_cgroup_hierarchy=0"
GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG=true

Then use this new default config as configuration for your boot loader:

$ sudo grub2-mkconfig > /boot/efi/EFI/fedora/grub.cfg

Don’t forget to reboot:

$ reboot

Once rebooted, start the Docker daemon as usual:

$ sudo systemctl start docker
Check out my book
Deployment from Scratch is unique Linux book about web application deployment. Learn how deployment works from the first principles rather than YAML files of a specific tool.
by Josef Strzibny
RSS