Docker on Fedora 33
In the article “Linux at Work”, I documented my testing of a Dell XPS 13 running Fedora 33 as my primary device for work.
Thanks to the growth of web applications and frameworks such as Electron, the experience was mostly positive, with only a few limitations, caused by the lack of a native Linux Microsoft Office 365 applications (Word, PowerPoint, Excel).
The only other challenge I experienced was related to software repositories that had not yet been updated to support Fedora 33 (which has now been officially released). For example, Docker, which I use for software development to package and run applications in containers.
Thankfully, with support from the open-source community, it was relatively easy to get a Docker compatible environment running on Fedora 33, taking advantage of components offered by the Moby Project.
The article aims to document the installation process of a Docker compatible environment on Fedora 33.
Moby Project
Moby is an open-source project, created by Docker, to enable and accelerate software containerisation.
It includes a framework and library of components that provide the building blocks to set up a custom container-based architecture, primarily targetting container enthusiasts and professionals. The image below highlights the core components of Moby.
I would still recommend using Docker Community Edition (CE) for mission-critical development, but the Moby Project can be used to enable a Docker compatible environment if the official Docker channel has not been updated (often the case with new operating system releases).
Control Groups (cgroups)
As part of the Linux kernel, control groups (AKA cgroups) are a collection of processes that are bound by the same criteria and associated with a set of parameters or limits. For example, cgroups support the following capabilities:
- Resource limiting: Limit memory usage, including the file system cache.
- Prioritisation: Prioritise processor utilisation and/or disk I/O throughput.
- Accounting: Measure resource usage, which can be used for billing purposes.
- Control: Freezing processes, their checkpointing and restarting.
There are two versions of cgroups (cgroups v1 and cgroups v2) currently available. Starting with Fedora 31, cgroups v2 was enabled by default. Although this was a positive step forward from a Linux kernel perspective (and I respect Fedora for leading the way), unfortunately, Docker, Mobyand Kubernetes are not yet compatible with cgroups v2.
As a result, to enable Docker or Moby on Fedora 33, cgroups v1 must be re-enabled.
Install Docker on Fedora 33
The following three steps outline how to install a Docker compatible environment on Fedora 33.
Step One: The following Terminal command will re-enable cgroups v1 on Fedora.
sudo grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0"
Step Two: The following Terminal commands will ensure Docker has the required network access to manage containers.
sudo firewall-cmd --permanent --zone=trusted --add-interface=docker0
sudo firewall-cmd --permanent --zone=FedoraWorkstation --add-masquerade
Step Three: The following Terminal commands will install and enable Docker compatible components.
sudo dnf install moby-engine docker-compose
sudo systemctl enable docker
Once the installation is complete, reboot Fedora.
To test the installation, simply run the following Terminal command to run the “Hello World” container.
sudo docker run hello-world
The screenshot below highlights a successful installation.
That’s it! You should now have a Docker compatible environment running on Fedora 33.
Conclusion
As previously stated, I would still recommend Docker CE for any mission-critical development. However, if you are impatient (or simply inquisitive), the Moby Project is viable and worth a look.