Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to run Docker in Fedora 32

Shulou Source: shulou.com Published: 2022-06-01 23:30:02 09月27日 Update

This article is to share with you about how to run Docker in Fedora 32. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article.

Step 1: system preparation

In the last two versions of Fedora, the operating system has migrated to two new technologies: CGroups and NFTables for firewalls. Although the details of these new technologies are beyond the scope of this tutorial, unfortunately, Docker does not support these new technologies yet. Therefore, you have to make some changes to use Docker on Fedora.

Enable the old CGroups

Fedora still supports the previous implementation of CGroups, which can be enabled using the following command:

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

Whitelist Docker in the firewall

In order for Docker to have network access, two commands are required:

Sudo firewall-cmd-permanent-zone=trusted-add-interface=docker0

Sudo firewall-cmd-permanent-zone=FedoraWorkstation-add-masquerade

The first command adds the Docker interface to the trusted environment, which allows Docker to establish a remote connection. The second command will allow Docker to establish a local connection. This is especially useful when you have multiple Docker containers as your development environment.

Step 2: install Moby

Moby is the open source white-card version of Docker. It is based on the same code, but without a trademark. It is included in the main repository of Fedora, so it is easy to install:

Sudo dnf install moby-engine docker-compose

This will install moby-engine, docker-compose, containerd, and other related libraries. After the installation is complete, you must enable the system-level daemon to run Docker:

Sudo systemctl enable docker

Step 3: restart and test

To ensure that all systems and settings are handled correctly, you must restart your computer now:

Sudo systemctl reboot

After that, you can use the Docker hello-world package to verify the installation:

Sudo docker run hello-world

Unless you have a problem, you will see greetings from Docker!

Run as an administrator

Optionally, you can now also add users to the Docker group account so that you can start the Docker image without entering sudo:

Sudo groupadd docker

Sudo usermod-aG docker $USER

Log out and log in for the changes to take effect. If the idea of running the container with administrator privileges worries you, then you should study Podman.

The above is how to run Docker in Fedora 32. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Tags: Run command system new technology step new technology two container more permissions version environment knowledge administrator article firewall support management fire prevention same Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Shulou Technology Redmi Linux Shulou Tech Info