dnf ce教学 openEuler 2203 LTS 安装 Docker CE 和 Dcoker Compose

小编 软件大全 87 0

openEuler 2203 LTS 安装 Docker CE 和 Dcoker Compose

@ 目录

1、更新系统

2、安装必要的软件包

3、添加 Docker CE 存储库

4、更新索引缓存并安装 Docker CE

5、启动 Docker 服务

6、查看 Docker 状态

7、设置 Docker 开机自启动

8、验证 Docker CE 安装

DNF 安装 Docker

DNF 是一款 Linux 软件包管理工具,用于管理 RPM 软件包。DNF 可以查询软件包信息,从指定软件库获取软件包,自动处理依赖关系以安装或卸载软件包,以及更新系统到最新可用版本。

在 openEuler 22.03 LTS 系统中,我们可以使用 DNF 包管理器来安装 Docker CE(社区版)。

关于《使用DNF管理软件包》,请查看 https://docs.openeuler.org/zh/docs/22.03_LTS/docs/Administration/使用DNF管理软件包.html

Docker 是一种流行的容器化平台,可以帮助开发人员快速构建、打包和发布应用程序。

docker

OS 系统环境准备

在开始之前,建议您使用具有 sudo 访问权限的 openEuler 22.03 LTS 服务器。确保您的系统已经更新到最新版本。您还需要具备一个稳定的互联网连接。

说明:关于 openEuler 22.03 LTS 服务器的安装部署这里不再说明,请自行查看相关文档。

安装 docker-ce 步骤

1、更新系统

在安装之前,请确保您的系统已经更新到最新版本。使用以下命令更新您的系统:

sudo dnf update -y

2、安装必要的软件包

安装所需的软件包以便使用 Docker CE 存储库:

sudo dnf install -y dnf-plugins-core

3、添加 Docker CE 存储库

此处添加 docker-ce.repo 源:

sudo dnf config-manager --add-repo=https://repo.huaweicloud.com/docker-ce/linux/centos/docker-ce.repo

注意:在修改 docker-ce.repo 原文件之前,为了保险可以执行如下命令先 copy 一份留作备份。

cp docker-ce.repo docker-ce.repo.bak

将 docker-ce.repo 中官方地址替换为华为开源镜像,提升下载速度。

sed -i 's+download.docker.com+repo.huaweicloud.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo

说明:docker-ce.repo 中用 $releasever 变量代替当前系统的版本号,该变量在 CentOS 中有效,但在 openEuler 中无效,所以将该变量直接改为8。

sed -i 's+$releasever+8+' /etc/yum.repos.d/docker-ce.repo

再次查看 docker-ce.repo 文件,输出信息如下:

[root@jumpServer yum.repos.d]# pwd/etc/yum.repos.d[root@jumpServer yum.repos.d]# lsdocker-ce.repo docker-ce.repo.bak openEuler.repo openEuler.repo.bak[root@jumpServer yum.repos.d]# cat docker-ce.repo[docker-ce-stable]name=Docker CE Stable - $basearchbaseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/8/$basearch/stableenabled=1gpgcheck=1gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg[docker-ce-stable-debuginfo]name=Docker CE Stable - Debuginfo $basearchbaseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/8/debug-$basearch/stableenabled=0gpgcheck=1gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg[docker-ce-stable-source]name=Docker CE Stable - Sourcesbaseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/8/source/stableenabled=0gpgcheck=1gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg[docker-ce-test]name=Docker CE Test - $basearchbaseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/8/$basearch/testenabled=0gpgcheck=1gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg[docker-ce-test-debuginfo]name=Docker CE Test - Debuginfo $basearchbaseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/8/debug-$basearch/testenabled=0gpgcheck=1gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg[docker-ce-test-source]name=Docker CE Test - Sourcesbaseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/8/source/testenabled=0gpgcheck=1gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg[docker-ce-nightly]name=Docker CE Nightly - $basearchbaseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/8/$basearch/nightlyenabled=0gpgcheck=1gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg[docker-ce-nightly-debuginfo]name=Docker CE Nightly - Debuginfo $basearchbaseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/8/debug-$basearch/nightlyenabled=0gpgcheck=1gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg[docker-ce-nightly-source]name=Docker CE Nightly - Sourcesbaseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/8/source/nightlyenabled=0gpgcheck=1gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg

4、更新索引缓存并安装 Docker CE

更新索引缓存:

dnf makecache

现在您可以使用 DNF 包管理器安装 Docker CE 了:

sudo dnf install -y docker-ce docker-ce-cli containerd.io

此处如果出现如下错误信息:

Error: Problem: package docker-ce-3:24.0.6-1.el8.x86_64 requires docker-ce-rootless-extras, but none of the providers can be installed - 无法为该任务安装最佳候选 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.0-3.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.0-3.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.1-3.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.1-3.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.10-3.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.10-3.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.11-3.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.11-3.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.12-3.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.12-3.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.13-3.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.13-3.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.14-3.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.14-3.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.15-3.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.15-3.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.16-3.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.16-3.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.17-3.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.17-3.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.18-3.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.18-3.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.19-3.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.19-3.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.2-3.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.2-3.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.20-3.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.20-3.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.21-3.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.21-3.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.22-3.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.22-3.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.23-3.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.23-3.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.24-3.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.24-3.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.3-3.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.3-3.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.4-3.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.4-3.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.5-3.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.5-3.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.6-3.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.6-3.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.7-3.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.7-3.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.8-3.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.8-3.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.9-3.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.9-3.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-23.0.0-1.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-23.0.0-1.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-23.0.1-1.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-23.0.1-1.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-23.0.2-1.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-23.0.2-1.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-23.0.3-1.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-23.0.3-1.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-23.0.4-1.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-23.0.4-1.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-23.0.5-1.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-23.0.5-1.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-23.0.6-1.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-23.0.6-1.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-24.0.0-1.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-24.0.0-1.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-24.0.1-1.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-24.0.1-1.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-24.0.2-1.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-24.0.2-1.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-24.0.3-1.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-24.0.3-1.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-24.0.4-1.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-24.0.4-1.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-24.0.5-1.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-24.0.5-1.el8.x86_64 - nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-24.0.6-1.el8.x86_64 - nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-24.0.6-1.el8.x86_64(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

依据上面提示信息,请执行如下命令:

(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)# 执行如下命令dnf install --skip-broken -y docker-ce docker-ce-cli containerd.io # 或者dnf install --nobest -y docker-ce docker-ce-cli containerd.io

安装成功输出如下信息:

[root@jumpServer yum.repos.d]# dnf install --skip-broken -y docker-ce docker-ce-cli containerd.io docker-compose-pluginLast metadata expiration check: 0:18:44 ago on 2023年10月24日 星期二 21时08分02秒.Dependencies resolved.================================================================================================================================== Package Architecture Version Repository Size==================================================================================================================================Installing: containerd.io x86_64 1.6.24-3.1.el8 docker-ce-stable 34 M docker-ce-cli x86_64 1:24.0.6-1.el8 docker-ce-stable 7.2 M docker-compose-plugin x86_64 2.21.0-1.el8 docker-ce-stable 13 MInstalling dependencies: container-selinux noarch 2:2.138-4.oe2203 OS 37 kInstalling weak dependencies: docker-buildx-plugin x86_64 0.11.2-1.el8 docker-ce-stable 13 MTransaction Summary==================================================================================================================================Install 5 PackagesTotal download size: 67 MInstalled size: 260 MDownloading Packages:(1/5): docker-ce-cli-24.0.6-1.el8.x86_64.rpm 2.4 MB/s | 7.2 MB 00:03 (2/5): docker-buildx-plugin-0.11.2-1.el8.x86_64.rpm 4.0 MB/s | 13 MB 00:03 (3/5): container-selinux-2.138-4.oe2203.noarch.rpm 135 kB/s | 37 kB 00:00 (4/5): docker-compose-plugin-2.21.0-1.el8.x86_64.rpm 3.4 MB/s | 13 MB 00:03 (5/5): containerd.io-1.6.24-3.1.el8.x86_64.rpm 4.2 MB/s | 34 MB 00:08 ----------------------------------------------------------------------------------------------------------------------------------Total 8.1 MB/s | 67 MB 00:08 Docker CE Stable - x86_64 3.9 kB/s | 1.6 kB 00:00 Importing GPG key 0x621E9F35: Userid : "Docker Release (CE rpm) <docker@docker.com>" Fingerprint: 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35 From : https://repo.huaweicloud.com/docker-ce/linux/centos/gpgKey imported successfullyRunning transaction checkTransaction check succeeded.Running transaction testTransaction test succeeded.Running transaction Preparing : 1/1 Installing : docker-compose-plugin-2.21.0-1.el8.x86_64 1/5 Running scriptlet: docker-compose-plugin-2.21.0-1.el8.x86_64 1/5 Installing : container-selinux-2:2.138-4.oe2203.noarch 2/5 Running scriptlet: container-selinux-2:2.138-4.oe2203.noarch 2/5 Installing : docker-buildx-plugin-0.11.2-1.el8.x86_64 3/5 Running scriptlet: docker-buildx-plugin-0.11.2-1.el8.x86_64 3/5 Installing : docker-ce-cli-1:24.0.6-1.el8.x86_64 4/5 Running scriptlet: docker-ce-cli-1:24.0.6-1.el8.x86_64 4/5 Installing : containerd.io-1.6.24-3.1.el8.x86_64 5/5 Running scriptlet: containerd.io-1.6.24-3.1.el8.x86_64 5/5 Verifying : containerd.io-1.6.24-3.1.el8.x86_64 1/5 Verifying : docker-buildx-plugin-0.11.2-1.el8.x86_64 2/5 Verifying : docker-ce-cli-1:24.0.6-1.el8.x86_64 3/5 Verifying : docker-compose-plugin-2.21.0-1.el8.x86_64 4/5 Verifying : container-selinux-2:2.138-4.oe2203.noarch 5/5 Installed: container-selinux-2:2.138-4.oe2203.noarch containerd.io-1.6.24-3.1.el8.x86_64 docker-buildx-plugin-0.11.2-1.el8.x86_64 docker-ce-cli-1:24.0.6-1.el8.x86_64 docker-compose-plugin-2.21.0-1.el8.x86_64 Skipped: docker-ce-3:24.0.6-1.el8.x86_64 docker-ce-rootless-extras-20.10.0-3.el8.x86_64 docker-ce-rootless-extras-20.10.1-3.el8.x86_64 docker-ce-rootless-extras-20.10.2-3.el8.x86_64 docker-ce-rootless-extras-20.10.3-3.el8.x86_64 docker-ce-rootless-extras-20.10.4-3.el8.x86_64 docker-ce-rootless-extras-20.10.5-3.el8.x86_64 docker-ce-rootless-extras-20.10.6-3.el8.x86_64 docker-ce-rootless-extras-20.10.7-3.el8.x86_64 docker-ce-rootless-extras-20.10.8-3.el8.x86_64 docker-ce-rootless-extras-20.10.9-3.el8.x86_64 docker-ce-rootless-extras-20.10.10-3.el8.x86_64 docker-ce-rootless-extras-20.10.11-3.el8.x86_64 docker-ce-rootless-extras-20.10.12-3.el8.x86_64 docker-ce-rootless-extras-20.10.13-3.el8.x86_64 docker-ce-rootless-extras-20.10.14-3.el8.x86_64 docker-ce-rootless-extras-20.10.15-3.el8.x86_64 docker-ce-rootless-extras-20.10.16-3.el8.x86_64 docker-ce-rootless-extras-20.10.17-3.el8.x86_64 docker-ce-rootless-extras-20.10.18-3.el8.x86_64 docker-ce-rootless-extras-20.10.19-3.el8.x86_64 docker-ce-rootless-extras-20.10.20-3.el8.x86_64 docker-ce-rootless-extras-20.10.21-3.el8.x86_64 docker-ce-rootless-extras-20.10.22-3.el8.x86_64 docker-ce-rootless-extras-20.10.23-3.el8.x86_64 docker-ce-rootless-extras-20.10.24-3.el8.x86_64 docker-ce-rootless-extras-23.0.0-1.el8.x86_64 docker-ce-rootless-extras-23.0.1-1.el8.x86_64 docker-ce-rootless-extras-23.0.2-1.el8.x86_64 docker-ce-rootless-extras-23.0.3-1.el8.x86_64 docker-ce-rootless-extras-23.0.4-1.el8.x86_64 docker-ce-rootless-extras-23.0.5-1.el8.x86_64 docker-ce-rootless-extras-23.0.6-1.el8.x86_64 docker-ce-rootless-extras-24.0.0-1.el8.x86_64 docker-ce-rootless-extras-24.0.1-1.el8.x86_64 docker-ce-rootless-extras-24.0.2-1.el8.x86_64 docker-ce-rootless-extras-24.0.3-1.el8.x86_64 docker-ce-rootless-extras-24.0.4-1.el8.x86_64 docker-ce-rootless-extras-24.0.5-1.el8.x86_64 docker-ce-rootless-extras-24.0.6-1.el8.x86_64 Complete!

5、启动 Docker 服务

安装完成后,使用以下命令启动 Docker 服务:

sudo systemctl start docker

6、查看 Docker 状态

此时我们可以执行以下命令来检查 Docker 运行状态:

systemctl status docker

输出如下信息,说明 Docker 启动成功。

[root@jumpServer yum.repos.d]# systemctl status docker● docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled) Active: active (running) since Tue 2023-10-24 21:34:02 CST; 25s agoTriggeredBy: ● docker.socket Docs: https://docs.docker.com Main PID: 36703 (dockerd) Tasks: 12 Memory: 53.2M CGroup: /system.slice/docker.service └─ 36703 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock10月 24 21:33:57 jumpServer dockerd[36703]: time="2023-10-24T21:33:57.069511140+08:00" level=error msg="Failed to built-in GetDri>10月 24 21:33:57 jumpServer dockerd[36703]: time="2023-10-24T21:33:57.740293753+08:00" level=warning msg="Your kernel does not su>10月 24 21:33:57 jumpServer dockerd[36703]: time="2023-10-24T21:33:57.740378255+08:00" level=warning msg="Your kernel does not su>10月 24 21:33:57 jumpServer dockerd[36703]: time="2023-10-24T21:33:57.740720161+08:00" level=info msg="Loading containers: start."10月 24 21:34:01 jumpServer dockerd[36703]: time="2023-10-24T21:34:01.031930591+08:00" level=info msg="Default bridge (docker0) i>10月 24 21:34:01 jumpServer dockerd[36703]: time="2023-10-24T21:34:01.631027992+08:00" level=info msg="Loading containers: done."10月 24 21:34:01 jumpServer dockerd[36703]: time="2023-10-24T21:34:01.998723535+08:00" level=info msg="Docker daemon" commit=99e3>10月 24 21:34:01 jumpServer dockerd[36703]: time="2023-10-24T21:34:01.998995040+08:00" level=info msg="Daemon has completed initi>10月 24 21:34:02 jumpServer dockerd[36703]: time="2023-10-24T21:34:02.499573901+08:00" level=info msg="API listen on /run/docker.>10月 24 21:34:02 jumpServer systemd[1]: Started Docker Application Container Engine.

7、设置 Docker 开机自启动

要在系统启动时自动启动 Docker 服务,请运行以下命令:

sudo systemctl enable docker

输出如下信息:

[root@jumpServer yum.repos.d]# sudo systemctl enable dockerCreated symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.

至此,您已经在 openEuler 22.03 LTS 系统成功安装并启动了 Docker CE。

8、验证 Docker CE 安装

要验证 Docker CE 是否正确安装,可以运行以下命令检查 Docker 版本:

docker version

如果一切正常,输出 Docker CE 的版本信息如下:

[root@jumpServer yum.repos.d]# docker versionClient: Docker Engine - Community Version: 24.0.6 API version: 1.40 (downgraded from 1.43) Go version: go1.20.7 Git commit: ed223bc Built: Mon Sep 4 12:33:07 2023 OS/Arch: linux/amd64 Context: defaultServer: Docker Engine - Community Engine: Version: 19.03.15 API version: 1.40 (minimum version 1.12) Go version: go1.13.15 Git commit: 99e3ed8919 Built: Sat Jan 30 03:15:19 2021 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.24 GitCommit: 61f9fd88f79f081d64d6fa3bb1a0dc71ec870523 runc: Version: 1.1.9 GitCommit: v1.1.9-0-gccaecfc docker-init: Version: 0.18.0 GitCommit: fec3683

安装 docker compose

Linux 平台下需要独立安装 docker-compose ,而 windows、mac 平台的docker desktop 在安装时会一起安装上 docker-compose。

目前 docker compose 稳定版本为 v2.21.0,以下示例都是基于此版本,很多博友写的教程都是基于用 python 编写的 v1 版本,和最新版本是稍有不同的。

V2 版本 docker compose 是以插件的方式作为 docker 的一部分的,安装 docker compose,现在官方提供了三种安装方式,分别是快捷安装、存储库安装和二进制文件安装。

此处使用快捷安装,执行如下命令:

dnf install -y docker-compose-plugin

查看 docker compose 版本信息和更多命令用法:

[root@jumpServer yum.repos.d]# docker compose versionDocker Compose version v2.21.0[root@jumpServer yum.repos.d]# docker compose Usage: docker compose [OPTIONS] COMMANDDefine and run multi-container applications with Docker.Options: --ansi string Control when to print ANSI control characters ("never"|"always"|"auto") (default "auto") --compatibility Run compose in backward compatibility mode --dry-run Execute command in dry run mode --env-file stringArray Specify an alternate environment file. -f, --file stringArray Compose configuration files --parallel int Control max parallelism, -1 for unlimited (default -1) --profile stringArray Specify a profile to enable --progress string Set type of progress output (auto, tty, plain, quiet) (default "auto") --project-directory string Specify an alternate working directory (default: the path of the, first specified, Compose file) -p, --project-name string Project nameCommands: build Build or rebuild services config Parse, resolve and render compose file in canonical format cp Copy files/folders between a service container and the local filesystem create Creates containers for a service. down Stop and remove containers, networks events Receive real time events from containers.exec Execute a command in a running container. images List images used by the created containerskill Force stop service containers. logs View output from containers ls List running compose projects pause Pause services port Print the public port for a port binding. ps List containers pull Pull service images push Push service images restart Restart service containers rm Removes stopped service containers run Run a one-off command on a service. start Start services stop Stop services top Display the running processes unpause Unpause services up Create and start containers version Show the Docker Compose version informationwait Block until the first service container stopsRun 'docker compose COMMAND --help' for more information on a command.

相关博文:

容器技术 — docker compose,https://blog.csdn.net/weixin_37648525/article/details/125115260

再次查看 docker 信息,执行如下命令:

[root@jumpServer yum.repos.d]# docker infoClient: Docker Engine - Community Version: 24.0.6 Context: default Debug Mode: false Plugins: buildx: Docker Buildx (Docker Inc.) Version: v0.11.2 Path: /usr/libexec/docker/cli-plugins/docker-buildx compose: Docker Compose (Docker Inc.) Version: v2.21.0 Path: /usr/libexec/docker/cli-plugins/docker-composeServer: Containers: 0 Running: 0 Paused: 0 Stopped: 0 Images: 0 Server Version: 19.03.15 Storage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Native Overlay Diff: true Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host ipvlan macvlan overlay Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: 61f9fd88f79f081d64d6fa3bb1a0dc71ec870523 runc version: v1.1.9-0-gccaecfc init version: fec3683 Security Options: seccomp Profile: default Kernel Version: 5.10.0-60.18.0.50.oe2203.x86_64 Operating System: openEuler 22.03 LTS OSType: linux Architecture: x86_64 CPUs: 4 Total Memory: 1.471GiB Name: jumpServer ID: V5Z4:LNBS:WSLD:EEXC:ARZ6:JE2I:SANG:YUB5:FGTO:EUWO:R27N:KOGK Docker Root Dir: /var/lib/docker Debug Mode: false Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false

总结

通过使用 DNF 包管理器,您可以在 openEuler 22.03 LTS 上轻松安装 Docker CE。Docker 是一个功能强大的容器化平台,可以帮助您更高效地构建和管理应用程序。

希望本文对您有所帮助。

CentOS 84上使用DNF安装 Docker服务

什么是Docker?Docker是一个开源项目,它允许在容器内部创建和分发应用程序,容器是可以独立于主机系统轻松复制的标准化环境。

DNF是什么?DNF是软件包管理器。它会在Linux发行版上安装,执行更新并删除软件包。CentOS 8使用DNF软件包管理器版本v4.x。

dnf ce教学 openEuler 2203 LTS 安装 Docker CE 和 Dcoker Compose

本文将详细介绍在CentOS 8.4中使用DNF安装Docker服务。

一、查看当前CentOS 系统版本信息

命令:lsb_release -a

dnf ce教学 openEuler 2203 LTS 安装 Docker CE 和 Dcoker Compose

或者命令:cat /etc/redhat-release (适用于RedHat,CentOS)

dnf ce教学 openEuler 2203 LTS 安装 Docker CE 和 Dcoker Compose

二、检查CentOS 8中是否已安装了Podman

CentOS 8中安装Docker出现和Podman冲突,因此先检查CentOS 中是否已经安装了Podman,如图所示。

[root@centos-103 ~]# rpm -q podman

podman-3.0.1-6.module_el8.4.0+781+acf4c33b.x86_64

dnf ce教学 openEuler 2203 LTS 安装 Docker CE 和 Dcoker Compose

显示在CentOS 8 操作系统中已经安装Podman。可以删除Podman,执行如下命令:

dnf remove podman

CentOS 7开始,dnf成为了默认的软件包管理器,同时 yum 仍然是可用的。dnf 包管理器克服了yum包管理器的一些瓶颈,提升了用户体验,内存占用,依赖分析,运行速度等方面。dnf 使维护软件包组变得容易,并且能够自动解决依赖性问题。

dnf ce教学 openEuler 2203 LTS 安装 Docker CE 和 Dcoker Compose

可以查看dnf 版本:dnf --version

输出结果如下所示,CentOS 8使用dnf软件包管理器版本v4.4.2。

[root@centos-103 ~]# dnf --version

Failed to set locale, defaulting to C.UTF-8

4.4.2

Installed: dnf-0:4.4.2-11.el8.noarch at Thu Sep 30 03:47:37 2021

Built : CentOS Buildsys <bugs@centos.org> at Thu Mar 11 19:39:23 2021

Installed: rpm-0:4.14.3-13.el8.x86_64 at Thu Sep 30 03:46:03 2021

Built : CentOS Buildsys <bugs@centos.org> at Tue Feb 16 07:03:14 2021

列出已安装的软件包:

# dnf list installed

列出所有可安装的软件包:

dnf list available

三、使用DNF安装Docker

使用DNF添加并启用官方Docker CE存储库。在终端窗口中输入以下命令:

dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo

dnf ce教学 openEuler 2203 LTS 安装 Docker CE 和 Dcoker Compose

上图显示系统通知已经成功地检索了存储库。

使用如下命令查看DNF相关的存储库:

dnf repolist -v

dnf ce教学 openEuler 2203 LTS 安装 Docker CE 和 Dcoker Compose

该存储库包含docker-ce软件包的多个版本,要显示所有版本,我们可以运行:

dnf list docker-ce --showduplicates | sort -r

dnf ce教学 openEuler 2203 LTS 安装 Docker CE 和 Dcoker Compose

不幸的是,CentOS 8 不支持特定版本的container.id包。这意味着只有一些版本的docker-ce可用于安装。

跳过具有损坏依赖性的程序包,一个有效的解决方案是使您的CentOS 8系统使用以下--nobest命令安装最符合条件的版本。

使用如下命令行进行安装docker-ce:

dnf install docker-ce --nobest

安装的时候,出现了如下错误:problem with installed package buildah。

[root@centos-103 ~]# dnf install docker-ce --nobest

Failed to set locale, defaulting to C.UTF-8

Last metadata expiration check: 0:14:33 ago on Sun Oct 3 01:23:07 2021.

Error:

Problem: problem with installed package buildah-1.19.7-1.module_el8.4.0+781+acf4c33b.x86_64

- package buildah-1.19.7-1.module_el8.4.0+781+acf4c33b.x86_64 requires runc >= 1.0.0-26, but none of the providers can be installed

- package buildah-1.21.4-2.module_el8.4.0+942+d25aada8.x86_64 requires runc >= 1.0.0-26, but none of the providers can be installed

- package buildah-1.21.4-1.module_el8.4.0+886+c9a8d9ad.x86_64 requires runc >= 1.0.0-26, but none of the providers can be installed

- package buildah-1.19.7-2.module_el8.4.0+830+8027e1c4.x86_64 requires runc >= 1.0.0-26, but none of the providers can be installed

根据输出提示,添加--alowerasing 参数,如下所示:

dnf install docker-ce --nobest --allowerasing

如图所示,安装完成(最后显示Complete!)。

dnf ce教学 openEuler 2203 LTS 安装 Docker CE 和 Dcoker Compose

四、启动Dock服务

安装Docker之后, 使用以下systemctl命令启动并启用其服务。

systemctl start docker

systemctl enable docker

dnf ce教学 openEuler 2203 LTS 安装 Docker CE 和 Dcoker Compose

输入以下命令查看docker版本号:

[root@centos-103 ~]# docker --version

Docker version 20.10.8, build 3967b7d

五、验证并测试Docker CE服务

执行如下命令,拉取并启动hello-world容器:

docker run hello-world

dnf ce教学 openEuler 2203 LTS 安装 Docker CE 和 Dcoker Compose

在上面的输出中看到的信息,可确认Docker引擎已在CentOS 8 服务器上正确安装。

查看docker服务运行状态:

systemctl status docker

dnf ce教学 openEuler 2203 LTS 安装 Docker CE 和 Dcoker Compose

另外,可以运行如下docker命令:

docker images 查看docker镜像;

docker ps 查看正在运行的容器;

dnf ce教学 openEuler 2203 LTS 安装 Docker CE 和 Dcoker Compose

另外,我们需要在CentOS 8 上禁用防火墙(firewalld),让docker容器中的DNS解析服务正常工作。执行如下命令即可:

systemctl disable firewalld

systemctl stop firewalld

systemctl status firewalld

如下输出表示firewalld 服务已经被禁用了。

dnf ce教学 openEuler 2203 LTS 安装 Docker CE 和 Dcoker Compose

DNF:遴选第一人是谁?CEO变身为“CE欧”,让旭旭宝宝都羡慕

DNF:遴选第一人是谁?CEO变身为“CE欧”,让旭旭宝宝都羡慕

DNF黑鸦之境更新后,地下城掀起了“挖矿”狂潮,各大主播相继发布“遴选令”,而其中最豪迈的当属旭旭宝宝:升级一件改造装备3000元、遴选一次装备10元!但是,面对遴选数值随机,“钞能力”在“欧皇之光”面前,也黯然失色,遴选第一人诞生,不是旭旭宝宝。

dnf ce教学 openEuler 2203 LTS 安装 Docker CE 和 Dcoker Compose

旭旭宝宝首次遴选

旭旭宝宝,全服第一位遴选改造史诗的玩家,为所有勇士上了真实的一课,在9450个矿石升级改8戒指成功后,进入遴选环节,1次遴选需要300个矿石,将3个词条全部洗满的几率为3%,但是,旭旭宝宝足足花了17万个矿石,才洗出满属性,被玩家戏称为“遴选大黑蛋子”。

dnf ce教学 openEuler 2203 LTS 安装 Docker CE 和 Dcoker Compose

17万只是起点

本以为17万个材料,遴选一件改造装备,已经是匪夷所思了,但这还不是旭旭宝宝的“黑”的极限,旭旭宝宝在遴选改8手镯的时候,运气更差,这一次遴选,足足消耗了32.6万矿石,遴选了1087次,才洗出满属性,旭旭宝宝升级为“遴选超级大黑蛋子”,无人能及。

dnf ce教学 openEuler 2203 LTS 安装 Docker CE 和 Dcoker Compose

改8护肩也很调皮

虽然遴选几率极低,但是旭旭宝宝没有放弃继续遴选,接下来遴选的是改8肩膀,最强的改造装备,32%技能攻击力提升让人眼馋,但是,这一次遴选又是超级黑,遴选了近2个小时,才最终成功!虽然过程很艰辛,但是结果让人非常满意,换上满属性的改8遴选护肩,旭旭宝宝测试了20秒打桩伤害,7,1万亿让人惊叹,改造装备恐怖如斯,让旭旭宝宝的红眼,进入7万亿大关,比第二名似雨幽离的5.5万亿伤害,已经不可同日而语了,没有可比性。

dnf ce教学 openEuler 2203 LTS 安装 Docker CE 和 Dcoker Compose

CEO变身CE“欧”

最后,旭旭宝宝遴选左槽,又是耗时约2小时,遴选上千次,但是却一直没有出满属性,这让旭旭宝宝很烦躁!最后,将改8左槽交由CEO遴选,CEO在增幅界,素有“CE0”的雅号,意思是运气差,增幅会“归0”,但让旭旭宝宝没有想到的是,仅仅几分钟后,CEO就发来喜讯,遴选27次成功,改8左槽完美毕业。弹幕纷纷打出“遴选第一人”,吐槽旭旭宝宝是“大黑蛋子”,旭旭宝宝对此乐得合不拢嘴,“别这样,这是我垫了1000多次的功劳”。

dnf ce教学 openEuler 2203 LTS 安装 Docker CE 和 Dcoker Compose

似雨幽离比旭旭宝宝还黑

改造装备的遴选,成功几率真的很低,理论上是3%,但是,可以肯定的是,最高属性词条的几率绝对低于千分之一,不仅旭旭宝宝遴选受挫,第一剑魂似雨幽离,在遴选肩膀的时候,也是遭遇失败,在他的直播间,赫然打出了“第1400次遴选,没满属性”的伤心标语。似雨幽离也是发动了整个大区的玩家,帮忙遴选,但是,让人气馁的是,旭旭宝宝已经升级遴选了4件了,而似雨幽离第一件遴选还没成功,是比旭旭宝宝还黑的“遴选大黑蛋子”。

dnf ce教学 openEuler 2203 LTS 安装 Docker CE 和 Dcoker Compose

小结

改造装备的遴选,3个词条,每个词条3个数值,看起来随机出满属性的几率,高达1/27,但是真正的实际操作后,才会发现这个坑无比的深,也只有各大主播,发动大区玩家的力量,才有可能实现最终的升级和遴选完美,改造装备真不愧是“土豪专属”。

我是玩家秀,祝勇士们深渊闪光不停,打团金牌不断,神话装备天天见。

发布评论 0条评论)

还木有评论哦,快来抢沙发吧~