openEuler 22.03 LTS 安装 Docker CE 和 Dcoker Compose

openEuler 使用 DNF 安装 Docker CE

  • 1024,节日快乐!
  • 回归正题,DNF 安装 Docker
  • OS 系统环境准备
  • 安装 docker-ce 步骤
    • 1、更新系统
    • 2、安装必要的软件包
    • 3、添加 Docker CE 存储库
    • 4、更新索引缓存并安装 Docker CE
    • 5、启动 Docker 服务
    • 6、查看 Docker 状态
    • 7、设置 Docker 开机自启动
    • 8、验证 Docker CE 安装
  • 安装 docker compose
  • 总结

1024,节日快乐!

敲下 “Hello,world”(你好,世界),是他们踏进计算机编程语言的开始;编写程序、修复漏洞(bug),是他们在 1024 世界的 “闯关” 日常。今天是 1024程序员节,祝大家节日快乐!

10·24程序员节

回归正题,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]# ls
docker-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 - $basearch
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/8/$basearch/stable
enabled=1
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg[docker-ce-stable-debuginfo]
name=Docker CE Stable - Debuginfo $basearch
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/8/debug-$basearch/stable
enabled=0
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg[docker-ce-stable-source]
name=Docker CE Stable - Sources
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/8/source/stable
enabled=0
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg[docker-ce-test]
name=Docker CE Test - $basearch
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/8/$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg[docker-ce-test-debuginfo]
name=Docker CE Test - Debuginfo $basearch
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/8/debug-$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg[docker-ce-test-source]
name=Docker CE Test - Sources
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/8/source/test
enabled=0
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg[docker-ce-nightly]
name=Docker CE Nightly - $basearch
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/8/$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg[docker-ce-nightly-debuginfo]
name=Docker CE Nightly - Debuginfo $basearch
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/8/debug-$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg[docker-ce-nightly-source]
name=Docker CE Nightly - Sources
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/8/source/nightly
enabled=0
gpgcheck=1
gpgkey=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

正常情况输出如下信息:

[root@jumpServer yum.repos.d]# dnf install -y docker-ce docker-ce-cli containerd.io
Last metadata expiration check: 0:00:15 ago on 2023年10月24日 星期二 20时10分04秒.
Dependencies resolved.
====================================================================================================================Package                             Architecture     Version                      Repository                  Size
====================================================================================================================
Installing:containerd.io                       x86_64           1.6.24-3.1.el8               docker-ce-stable            34 Mdocker-ce                           x86_64           3:24.0.6-1.el8               docker-ce-stable            24 Mdocker-ce-cli                       x86_64           1:24.0.6-1.el8               docker-ce-stable           7.2 M
Installing dependencies:docker-ce-rootless-extras           x86_64           24.0.6-1.el8                 docker-ce-stable           4.9 Mlibcgroup                           x86_64           0.42.2-2.oe2203              update                      97 ktar                                 x86_64           2:1.34-4.oe2203              update                     785 k
Installing weak dependencies:docker-buildx-plugin                x86_64           0.11.2-1.el8                 docker-ce-stable            13 Mdocker-compose-plugin               x86_64           2.21.0-1.el8                 docker-ce-stable            13 MTransaction Summary
====================================================================================================================
Install  8 PackagesTotal download size: 97 M
Installed size: 370 M
Downloading Packages:
(1/8): docker-buildx-plugin-0.11.2-1.el8.x86_64.rpm                                 1.8 MB/s |  13 MB     00:07    
(2/8): docker-ce-24.0.6-1.el8.x86_64.rpm                                            2.2 MB/s |  24 MB     00:11    
(3/8): docker-ce-cli-24.0.6-1.el8.x86_64.rpm                                        1.5 MB/s | 7.2 MB     00:04    
(4/8): docker-ce-rootless-extras-24.0.6-1.el8.x86_64.rpm                            1.7 MB/s | 4.9 MB     00:02    
(5/8): containerd.io-1.6.24-3.1.el8.x86_64.rpm                                      2.3 MB/s |  34 MB     00:14    
(6/8): libcgroup-0.42.2-2.oe2203.x86_64.rpm                                          65 kB/s |  97 kB     00:01    
(7/8): docker-compose-plugin-2.21.0-1.el8.x86_64.rpm                                3.1 MB/s |  13 MB     00:04    
(8/8): tar-1.34-4.oe2203.x86_64.rpm                                                 535 kB/s | 785 kB     00:01    
--------------------------------------------------------------------------------------------------------------------
Total                                                                               5.8 MB/s |  97 MB     00:16     
Docker CE Stable - x86_64                                                           6.8 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 9F35From       : https://repo.huaweicloud.com/docker-ce/linux/centos/gpg
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transactionPreparing        :                                                                                            1/1 Installing       : docker-compose-plugin-2.21.0-1.el8.x86_64                                                  1/8 Running scriptlet: docker-compose-plugin-2.21.0-1.el8.x86_64                                                  1/8 Running scriptlet: tar-2:1.34-4.oe2203.x86_64                                                                 2/8 Installing       : tar-2:1.34-4.oe2203.x86_64                                                                 2/8 Running scriptlet: tar-2:1.34-4.oe2203.x86_64                                                                 2/8 Running scriptlet: libcgroup-0.42.2-2.oe2203.x86_64                                                           3/8 Installing       : libcgroup-0.42.2-2.oe2203.x86_64                                                           3/8 Running scriptlet: libcgroup-0.42.2-2.oe2203.x86_64                                                           3/8 Installing       : docker-buildx-plugin-0.11.2-1.el8.x86_64                                                   4/8 Running scriptlet: docker-buildx-plugin-0.11.2-1.el8.x86_64                                                   4/8 Installing       : docker-ce-cli-1:24.0.6-1.el8.x86_64                                                        5/8 Running scriptlet: docker-ce-cli-1:24.0.6-1.el8.x86_64                                                        5/8 Installing       : containerd.io-1.6.24-3.1.el8.x86_64                                                        6/8 Running scriptlet: containerd.io-1.6.24-3.1.el8.x86_64                                                        6/8 Installing       : docker-ce-rootless-extras-24.0.6-1.el8.x86_64                                              7/8 Running scriptlet: docker-ce-rootless-extras-24.0.6-1.el8.x86_64                                              7/8 Installing       : docker-ce-3:24.0.6-1.el8.x86_64                                                            8/8 Running scriptlet: docker-ce-3:24.0.6-1.el8.x86_64                                                            8/8 Verifying        : containerd.io-1.6.24-3.1.el8.x86_64                                                        1/8 Verifying        : docker-buildx-plugin-0.11.2-1.el8.x86_64                                                   2/8 Verifying        : docker-ce-3:24.0.6-1.el8.x86_64                                                            3/8 Verifying        : docker-ce-cli-1:24.0.6-1.el8.x86_64                                                        4/8 Verifying        : docker-ce-rootless-extras-24.0.6-1.el8.x86_64                                              5/8 Verifying        : docker-compose-plugin-2.21.0-1.el8.x86_64                                                  6/8 Verifying        : libcgroup-0.42.2-2.oe2203.x86_64                                                           7/8 Verifying        : tar-2:1.34-4.oe2203.x86_64                                                                 8/8 Installed:containerd.io-1.6.24-3.1.el8.x86_64                        docker-buildx-plugin-0.11.2-1.el8.x86_64              docker-ce-3:24.0.6-1.el8.x86_64                            docker-ce-cli-1:24.0.6-1.el8.x86_64                   docker-ce-rootless-extras-24.0.6-1.el8.x86_64              docker-compose-plugin-2.21.0-1.el8.x86_64             libcgroup-0.42.2-2.oe2203.x86_64                           tar-2:1.34-4.oe2203.x86_64                            Complete!

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

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-plugin
Last 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 Mdocker-ce-cli                        x86_64                1:24.0.6-1.el8                  docker-ce-stable                7.2 Mdocker-compose-plugin                x86_64                2.21.0-1.el8                    docker-ce-stable                 13 M
Installing dependencies:container-selinux                    noarch                2:2.138-4.oe2203                OS                               37 k
Installing weak dependencies:docker-buildx-plugin                 x86_64                0.11.2-1.el8                    docker-ce-stable                 13 MTransaction Summary
==================================================================================================================================
Install  5 PackagesTotal download size: 67 M
Installed size: 260 M
Downloading 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 9F35From       : https://repo.huaweicloud.com/docker-ce/linux/centos/gpg
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transactionPreparing        :                                                                                                          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 EngineLoaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)Active: active (running) since Tue 2023-10-24 21:34:02 CST; 25s ago
TriggeredBy: ● docker.socketDocs: https://docs.docker.comMain PID: 36703 (dockerd)Tasks: 12Memory: 53.2MCGroup: /system.slice/docker.service└─ 36703 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock1024 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>
1024 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>
1024 21:34:01 jumpServer dockerd[36703]: time="2023-10-24T21:34:01.631027992+08:00" level=info msg="Loading containers: done."
1024 21:34:01 jumpServer dockerd[36703]: time="2023-10-24T21:34:01.998723535+08:00" level=info msg="Docker daemon" commit=99e3>
1024 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.>
1024 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 docker
Created 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 version
Client: Docker Engine - CommunityVersion:           24.0.6API version:       1.40 (downgraded from 1.43)Go version:        go1.20.7Git commit:        ed223bcBuilt:             Mon Sep  4 12:33:07 2023OS/Arch:           linux/amd64Context:           defaultServer: Docker Engine - CommunityEngine:Version:          19.03.15API version:      1.40 (minimum version 1.12)Go version:       go1.13.15Git commit:       99e3ed8919Built:            Sat Jan 30 03:15:19 2021OS/Arch:          linux/amd64Experimental:     falsecontainerd:Version:          1.6.24GitCommit:        61f9fd88f79f081d64d6fa3bb1a0dc71ec870523runc:Version:          1.1.9GitCommit:        v1.1.9-0-gccaecfcdocker-init:Version:          0.18.0GitCommit:        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 version
Docker 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 servicesconfig      Parse, resolve and render compose file in canonical formatcp          Copy files/folders between a service container and the local filesystemcreate      Creates containers for a service.down        Stop and remove containers, networksevents      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 containersls          List running compose projectspause       Pause servicesport        Print the public port for a port binding.ps          List containerspull        Pull service imagespush        Push service imagesrestart     Restart service containersrm          Removes stopped service containersrun         Run a one-off command on a service.start       Start servicesstop        Stop servicestop         Display the running processesunpause     Unpause servicesup          Create and start containersversion     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 info
Client: Docker Engine - CommunityVersion:    24.0.6Context:    defaultDebug Mode: falsePlugins:buildx: Docker Buildx (Docker Inc.)Version:  v0.11.2Path:     /usr/libexec/docker/cli-plugins/docker-buildxcompose: Docker Compose (Docker Inc.)Version:  v2.21.0Path:     /usr/libexec/docker/cli-plugins/docker-composeServer:Containers: 0Running: 0Paused: 0Stopped: 0Images: 0Server Version: 19.03.15Storage Driver: overlay2Backing Filesystem: extfsSupports d_type: trueNative Overlay Diff: trueLogging Driver: json-fileCgroup Driver: cgroupfsPlugins:Volume: localNetwork: bridge host ipvlan macvlan null overlayLog: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslogSwarm: inactiveRuntimes: runcDefault Runtime: runcInit Binary: docker-initcontainerd version: 61f9fd88f79f081d64d6fa3bb1a0dc71ec870523runc version: v1.1.9-0-gccaecfcinit version: fec3683Security Options:seccompProfile: defaultKernel Version: 5.10.0-60.18.0.50.oe2203.x86_64Operating System: openEuler 22.03 LTSOSType: linuxArchitecture: x86_64CPUs: 4Total Memory: 1.471GiBName: jumpServerID: V5Z4:LNBS:WSLD:EEXC:ARZ6:JE2I:SANG:YUB5:FGTO:EUWO:R27N:KOGKDocker Root Dir: /var/lib/dockerDebug Mode: falseExperimental: falseInsecure Registries:127.0.0.0/8Live Restore Enabled: false

总结

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

希望本文对您有所帮助。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/117880.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

数字驱动,营销赋能丨工商职院电子商务专业学生,前往餐饮美食电商新业态基地试岗交流

纸上得来终觉浅&#xff0c;绝知此事要躬行。为了让学生更好的了解自己与所应聘岗位的匹配度&#xff0c;同时也希望在实际业务场景中&#xff0c;发掘自身优势&#xff0c;10月23日&#xff0c;四川产教融创园信息技术有限公司组织四川工商职业技术学院的电子商务专业学生一行…

微软成AI热潮大赢家,继续押注大模型和人工智能

KlipC报道&#xff1a;微软在官网发布了财报&#xff0c;据数据显示该公司营收同比增长13%达565亿美元&#xff0c;营业利润同比增长25%达269亿美元&#xff0c;净利润同比增长27%达223亿美元。 KlipC的合伙人Andi D表示&#xff1a;“微软的智能云部门收入同比增长19%&#xf…

新成果展示:AlGaN/GaN基紫外光电晶体管的设计与制备

紫外光电探测器被广泛应用于导弹预警、火灾探测、非可见光通信、环境监测等民事和军事领域&#xff0c;这些应用场景的实现需要器件具有高信噪比和高灵敏度。因此&#xff0c;光电探测器需要具备响应度高、响应速度快和暗电流低的特性。近期&#xff0c;天津赛米卡尔科技有限公…

JAVA电商平台免费搭建 B2B2C商城系统 多用户商城系统 直播带货 新零售商城 o2o商城 电子商务 拼团商城 分销商城

涉及平台 平台管理、商家端&#xff08;PC端、手机端&#xff09;、买家平台&#xff08;H5/公众号、小程序、APP端&#xff08;IOS/Android&#xff09;、微服务平台&#xff08;业务服务&#xff09; 2. 核心架构 Spring Cloud、Spring Boot、Mybatis、Redis …

《红蓝攻防对抗实战》三.内网探测协议出网之HTTP/HTTPS协议探测出网

目录 一. 在 Windows 操作系统中探测 HTTP/HTTPS 出网 1. Bitsadmin 命令 2.Certuil 命令 2.Linux系统探测HTTP/HTTPS出网 1.Curl命令 2.Wget命令 对目标服务器探测 HTTP/HTTPS 是否出网时&#xff0c;要根据目标系统类型执行命令&#xff0c;不同类型的操作系统使用的探…

【IDEA查看一个jar包的依赖】

首先install,打jar包 重新创建一个项目 选中刚才的jar包 在这个包下就能看到jar包的依赖了

ES SearchAPI----Query DSL语言

文章目录 Getting Startedmatch_all查询全部sort排序from\size分页_source指定字段 match匹配查询match_phrase短语匹配multi_match多字段匹配range范围查询bool复合查询must必须匹配&#xff0c;可贡献得分must_not必须不匹配&#xff0c;可贡献得分should可有可无&#xff0c…

AnkiPDF Guru软件评测:打开全新学习方式的大门

在当今信息爆炸的时代&#xff0c;如何高效学习和记忆成为了每个人关注的焦点。AnkiPDF Guru软件作为结合了Anki和PDF的学习利器&#xff0c;向我们展示了一种全新的学习方式。本文将以软件的实用性和使用场景为切入点&#xff0c;从专业的角度客观分析和评测该软件&#xff0c…

Mysql主从集群同步延迟问题怎么解决

主从复制 复制过程分为几个步骤&#xff1a; 主库的更新事件(update、insert、delete)被写到binlog 从库发起连接&#xff0c;连接到主库。 此时主库创建一个 binlog dump thread&#xff0c;把 binlog 的内容发送到从库。 从库启动之后&#xff0c;创建一个 I/O 线程&#xff…

Pillow库(PIL)入门教程

Pillow库&#xff0c;PIL的升级版&#xff0c;一个免费开源的Python图像处理库。 Pillow 库&#xff08;有时也称 PIL 库&#xff09; 是 Python 图像处理的基础库&#xff0c;它是一个免费开源的第三方库&#xff0c;由一群 Python 社区志愿者使用 Python 语言开发而成&#…

数字化营销如何推动企业营收增长?数字化营销要点有哪些?

在数字化席卷而来的时代&#xff0c;企业若想在激烈的市场竞争中脱颖而出&#xff0c;就得紧跟潮流&#xff0c;运用数字化营销手段更快、更准地触达目标客户&#xff0c;从而帮助企业更好地解读客户需求&#xff0c;捕捉痛点&#xff0c;实现精细化营销闭环。 数字化营销如何让…

经典卷积神经网络 - GoogLeNet

GoogLeNet是google推出的基于Inception模块的深度神经网络模型&#xff0c;在2014年的ImageNet竞赛中夺得了冠军&#xff0c;在随后的两年中一直在改进&#xff0c;形成了Inception V2、Inception V3、Inception V4等版本。 Inception块 4个路径从不同层面抽取信息&#xff0…

java版opencv之Javacv各种场景使用案例

文章目录 1.关于Javacv~~2. [官网下载最新OpenCV4.8](https://opencv.org/releases/)&#xff0c;并解压~~ *不一定要安装opencv*~~3. 将opencv的jar包及动态库dll文件引入项目~~4.pom引入javacv库5.测试5.1 图片美颜5.2 图片人脸检测5.3 提取视频中的语音5.4 音视频剪辑5.5 录…

shell脚本实战案例--系统服务脚本

目录 1、源码编译安装nginx 2、分别编写基于RHEL6和RHEL7的脚本。 2.1 RHEL6的nginx系统服务脚本 2.2 RHEL7的nginx系统服务脚本 1、源码编译安装nginx 1.首先关闭防火墙和selinux [rootnode13 ~]# systemctl stop firewalld [rootnode13 ~]# setenforce 0 2.准备环境&…

java类的动态加载

java类的动态加载 java动态加载的机制&#xff1a; ClassLoader->SecureClassloader–>URLClassLoader–>AppClassLoader loadClass–>findClass(重写方法)–>defineClass(从字节码加载类) 初始化的时候会加载静态代码块 实例化的时候会加载构造代码块、无参构…

单片机设计_RTC时钟(ACM32F403)

一、电路设计 ACM32F403开发板 实现结果&#xff1a;通过串口发送每秒的时间 二、运行结果 三、部分代码 #include "APP.h"UART_HandleTypeDef Uart_Handle;/********************************************************************************* * Function …

Banana Pi BPI-W3(Armsom W3)RK3588开当板之调试UART

前言 本文主要讲解如何关于RK3588开发板UART的使用和调试方法&#xff0c;包括UART作为普通串口和控制台两种不同使用场景 一. 功能特点 Rockchip UART (Universal Asynchronous Receiver/Transmitter) 基于16550A串口标准&#xff0c;完整模块支持以下功能&#xff1a; 支…

gRPC之gateway集成swagger

1、gateway集成swagger 1、为了简化实战过程&#xff0c;gRPC-Gateway暴露的服务并未使用https&#xff0c;而是http&#xff0c;但是swagger-ui提供的调用服 务却是https的&#xff0c;因此要在proto文件中指定swagger以http调用服务&#xff0c;指定的时候会用到文件 prot…

深入浅出Dart》函数

函数 Dart语言作为一门面向对象的语言&#xff0c;函数在其中占据了非常重要的位置。本文将详细解析如何定义和调用函数&#xff0c;以及箭头语法&#xff0c;高阶函数和闭包等内容。 1. 函数的定义和调用 在Dart中&#xff0c;函数可以定义为一段实现特定功能的代码块&…

Pytorch使用torchvision.datasets.ImageFolder读取数据集,数据集的内容排列状况

当使用torchvision.datasets.ImageFolder读取猫狗数据集时,dataset中存的图片是 猫狗猫狗猫狗猫狗 还是 猫猫猫猫狗狗狗狗 呢? 数据集文件的存放路径如下图 测试代码如下 import torch import torchvisiontransform torchvision.transforms.Compose([torchvision.transform…