From c8ed957dc2203abb2bdc477b22720eee69a5b1e5 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 13 Jul 2020 08:42:18 +0800 Subject: [PATCH] translated --- sources/tech/20200626 Docker and Fedora 32.md | 120 ------------------ .../tech/20200626 Docker and Fedora 32.md | 120 ++++++++++++++++++ 2 files changed, 120 insertions(+), 120 deletions(-) delete mode 100644 sources/tech/20200626 Docker and Fedora 32.md create mode 100644 translated/tech/20200626 Docker and Fedora 32.md diff --git a/sources/tech/20200626 Docker and Fedora 32.md b/sources/tech/20200626 Docker and Fedora 32.md deleted file mode 100644 index 26460e8005..0000000000 --- a/sources/tech/20200626 Docker and Fedora 32.md +++ /dev/null @@ -1,120 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Docker and Fedora 32) -[#]: via: (https://fedoramagazine.org/docker-and-fedora-32/) -[#]: author: (Kevin "Eonfge" Degeling https://fedoramagazine.org/author/eonfge/) - -Docker and Fedora 32 -====== - -![][1] - -With the release of Fedora 32, regular users of [Docker][2] have been confronted by a small challenge. At the time of writing, Docker is not supported on Fedora 32. There are alternatives, like [Podman][3] and [Buildah][4], but for many existing users, switching now might not be the best time. As such, this article can help you set up your Docker environment on Fedora 32. - -### Step 0: Removing conflicts - -This step is for any user upgrading from Fedora 30 or 31. If this is a fresh installation of Fedora 32, you can move on to step 1. - -To remove docker and all its related components: - -``` -sudo dnf remove docker-* -sudo dnf config-manager --disable docker-* -``` - -### Step 1: System preparation - -With the last two versions of Fedora, the operating system has moved to two new technologies: CGroups and NFTables for the Firewall. While the details of these new technologies is behind the scope of this tutorial, it’s a sad fact that docker doesn’t support them yet. As such, you’ll have to make some changes to facilitate Docker on Fedora. - -#### Enable old CGroups - -The previous implementation of CGroups is still supported and it can be enabled using the following command. - -``` -sudo grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0" -``` - -#### Whitelist docker in firewall - -To allow Docker to have network access, two commands are needed. - -``` -sudo firewall-cmd --permanent --zone=trusted --add-interface=docker0 -sudo firewall-cmd --permanent --zone=FedoraWorkstation --add-masquerade -``` - -The first command will add the Docker-interface to the trusted environment which allows Docker to make remote connections. The second command will allow docker to make local connections. This is particularly useful when multiple Docker containers are in as a development environment. - -### Step 2: installing Moby - -[Moby][5] is the open-source, white label version of Docker. It’s based on the same code but it does not carry the trademark. It’s included in the main Fedora repository, which makes it easy to install. - -``` -sudo dnf install moby-engine docker-compose -``` - -This installs _moby-engine_, _docker-compose_, _containerd_ and some other related libraries. Once installed, you’ll have to enable the system-wide daemon to run docker. - -``` -sudo systemctl enable docker -``` - -### Step 3: Restart and test - -To ensure that all systems and settings are properly processed, you’ll now have to reboot your machine. - -``` -sudo systemctl reboot -``` - -After that, you can validate your installation using the Docker hello-world package. - -``` -sudo docker run hello-world -``` - -You are then greeted by the Hello from Docker! unless something went wrong. - -#### Running as admin - -Optionally, you can now also add your user to the group account of Docker, so that you can start docker images without typing _sudo_. - -``` -sudo groupadd docker -sudo usermod -aG docker $USER -``` - -Logout and login for the change to take effect. If the thought of running containers with administrator privileges concerns you, then you should look into Podman. - -### In summary - -From this point on, Docker will work how you’re used to, including docker-compose and all docker-related tools. Don’t forget to check out the official documentation which can help you in many cases where something isn’t quite right. - -The current state of Docker on Fedora 32 is not ideal. The lack of an official package might bother some, and there is an [issue upstream][6] where this is discussed. The missing support for both [CGroups][7] and [NFTables][8] is more technical, but you can check their progress in their public issues. - -These instruction should allow you to continue working like nothing has happened. If this has not satisfied your needs, don’t forget to address your technical issues at the Moby or Docker Github pages, or take a look at Podman which might prove more robust in the long-term future. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/docker-and-fedora-32/ - -作者:[Kevin "Eonfge" Degeling][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://fedoramagazine.org/author/eonfge/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2020/06/f32-04-twilight-816x459.png -[2]: https://docs.docker.com/ -[3]: https://podman.io/getting-started/ -[4]: https://buildah.io/ -[5]: https://mobyproject.org/ -[6]: https://github.com/docker/for-linux/issues/955 -[7]: https://github.com/moby/moby/issues/40360 -[8]: https://github.com/moby/moby/issues/26824 diff --git a/translated/tech/20200626 Docker and Fedora 32.md b/translated/tech/20200626 Docker and Fedora 32.md new file mode 100644 index 0000000000..274c85396f --- /dev/null +++ b/translated/tech/20200626 Docker and Fedora 32.md @@ -0,0 +1,120 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Docker and Fedora 32) +[#]: via: (https://fedoramagazine.org/docker-and-fedora-32/) +[#]: author: (Kevin "Eonfge" Degeling https://fedoramagazine.org/author/eonfge/) + +Docker 和 Fedora 32 +====== + +![][1] + +随着 Fedora 32 的发布,[Docker][2] 的普通用户面临着一个小挑战。在编写本文时,Fedora 32 不支持 Docker。还有其他选择,例如 [Podman][3] 和 [Buildah][4],但是对于许多现有用户而言,现在切换可能不是最佳时机。因此,本文可以帮助你在 Fedora 32 上设置 Docker 环境。 + +### 步骤 0:消除冲突 + +此步骤适用于从 Fedora 30 或 31 升级的任何用户。如果全新安装的 Fedora 32,那么可以跳到步骤 1。 + +删除 docker 及其所有相关组件: + +``` +sudo dnf remove docker-* +sudo dnf config-manager --disable docker-* +``` + +### 步骤 1:系统准备 + +在 Fedora 的最后两个版本中,操作系统已迁移到两项新技术:用于防火墙的 CGroups 和 NFTables。尽管这些新技术的详细信息不在本教程的讨论范围之内,但是令人遗憾的是,Docker 还不支持这些新技术。因此,你必须进行一些更改才能在 Fedora 上使用 Docker。 + +#### 启用旧的 CGroups + +Fedora 仍然支持 CGroups 的先前实现,可以使用以下命令启用它。 + +``` +sudo grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0" +``` + +#### 将防火墙中的 Docker 列入白名单 + +为了让 Docker 具有网络访问权限,需要两个命令。 + +``` +sudo firewall-cmd --permanent --zone=trusted --add-interface=docker0 +sudo firewall-cmd --permanent --zone=FedoraWorkstation --add-masquerade +``` + +第一个命令将 Docker 接口添加到受信任的环境,它允许 Docker 建立远程连接。第二个命令将允许 docker 建立本地连接。当有多个 Docker 容器作为开发环境时,这特别有用。 + +### 步骤 2:安装 Moby + +[Moby][5] 是 Docker 的开源白标版本。它基于相同的代码,但没有商标。它包含在 Fedora 的主仓库中,因此很容易安装。 + +``` +sudo dnf install moby-engine docker-compose +``` + +这将安装 _moby-engine _、_ docker-compose _、_ containerd_ 和其他一些相关的库。安装完成后,你必须启用系统级守护程序才能运行 docker。 + +``` +sudo systemctl enable docker +``` + +### 步骤 3:重新启动并测试 + +为了确保正确处理所有系统和设置,你现在必须重启计算机。 + +``` +sudo systemctl reboot +``` + +之后,你可以使用 Docker hello-world 包来验证安装。 + +``` +sudo docker run hello-world +``` + +除非遇到问题,不然你就会看到来自 Docker 的 Hello 问候! + +#### 以管理员身份运行 + +可选地,你现在还可以将用户添加到 Docker 的组帐户中,以便无需输入 _sudo_ 即可启动 Docker 镜像。 + +``` +sudo groupadd docker +sudo usermod -aG docker $USER +``` + +注销并登录以使更改生效。如果以管理员权限运行容器的想法让你顾虑,那么你应该研究 Podman。 + +### 总结 + +从现在起,Docker 将按照你的习惯工作,包括 docker-compose 和所有与 docker 相关的工具。不要忘记查看官方文档,这在很多情况下可以为你提供帮助。 + +Fedora 32 上 Docker 的当前状态并不理想。缺少官方软件包可能会困扰一些人,并且有一个[上游问题][6]对此进行了讨论。对 [CGroups][7] 和 [NFTables][8] 都缺少支持更多是技术问题,但是你可以查看它们在其公共问题上的进展。 + +这些指导应可以让你就像什么都没有发生一样继续工作。如果这不能满足你的需求,请不要忘记到 Moby 或 Docker Github 页面去解决你的技术问题,或者看看 Podman,长期它可能会更加强大。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/docker-and-fedora-32/ + +作者:[Kevin "Eonfge" Degeling][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/eonfge/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/06/f32-04-twilight-816x459.png +[2]: https://docs.docker.com/ +[3]: https://podman.io/getting-started/ +[4]: https://buildah.io/ +[5]: https://mobyproject.org/ +[6]: https://github.com/docker/for-linux/issues/955 +[7]: https://github.com/moby/moby/issues/40360 +[8]: https://github.com/moby/moby/issues/26824