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 M
 docker-ce                           x86_64           3:24.0.6-1.el8               docker-ce-stable            24 M
 docker-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 M
 libcgroup                           x86_64           0.42.2-2.oe2203              update                      97 k
 tar                                 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 M
 docker-compose-plugin               x86_64           2.21.0-1.el8                 docker-ce-stable            13 M

Transaction Summary
====================================================================================================================
Install  8 Packages

Total 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 9F35
 From       : 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 transaction
  Preparing        :                                                                                            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 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 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 M

Transaction Summary
==================================================================================================================================
Install  5 Packages

Total 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 9F35
 From       : 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 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 ago
TriggeredBy: ● 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.sock

1024 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 - 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:           default

Server: 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 version
Docker Compose version v2.21.0
[root@jumpServer yum.repos.d]# docker compose 

Usage:  docker compose [OPTIONS] COMMAND

Define 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 name

Commands:
  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 containers
  kill        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 information
  wait        Block until the first service container stops

Run '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 - 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-compose

Server:
 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 null 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 CEDocker 是一个功能强大的容器化平台,可以帮助您更高效地构建和管理应用程序。

希望本文对您有所帮助。

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

如何公网远程访问本地WebSocket服务端

本地websocket服务端暴露至公网访问【cpolar内网穿透】 文章目录 本地websocket服务端暴露至公网访问【cpolar内网穿透】1. Java 服务端demo环境2. 在pom文件引入第三包封装的netty框架maven坐标3. 创建服务端,以接口模式调用,方便外部调用4. 启动服务,出现以下信息表示启动成功…

Lvs+Nginx+NDS

什么是&#xff1f;为什么&#xff1f;需要负载均衡 一个网站在创建初期&#xff0c;一般来说都是只有一台服务器对用户提供服务 ​ 从图里可以看出&#xff0c;用户经过互联网直接连接了后端服务器&#xff0c;如果这台服务器什么时候突然 GG 了&#xff0c;用户将无法访问这…

从InnoDB索引的数据结构,去理解索引

从InnoDB索引的数据结构&#xff0c;去理解索引 1、InnoDB 中的 BTree1.1、BTree 的组成1.2、BTree中的数据页 2、聚簇索引2.1、聚簇索引的特点2.2、聚簇索引的结构示例2.3、聚簇索引的优缺点 3、非聚簇索引3.1、非聚簇索引结构示例3.2、关于回表3.3、聚簇索引和非聚簇索引的区…

Spring Boot 配置邮件发送服务

文章归档&#xff1a;https://www.yuque.com/u27599042/coding_star/ctwkrus1r9zrytsq spring boot 版本 3.1.3 邮件发送服务使用的 QQ 邮箱提供的 依赖 <parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent…

竹云产品入选《2023年度上海市网络安全产业创新攻关成果目录》

为推进网络安全产业发展&#xff0c;建设网络安全产业创新高地&#xff0c;上海市经济和信息化委员会于10月24日正式发布《2023年度上海市网络安全产业创新攻关成果目录》&#xff0c;共评选出16项创新成果&#xff0c;其中包括基础技术创新8项、应用技术创新4项、服务业态创新…

超详细的Windows 11虚拟机安装教程

准备安装文件创建虚拟机Windows安装 准备安装文件 1、安装好VMware WorkStation 16 Pro&#xff08;越新越好&#xff09; 2、下载好Windows 11系统镜像 其中VMware的安装教程看我往期推送&#xff0c;至少用我提供的16.2版本&#xff0c;低版本的会出现蓝屏问题。Windows …

深入探究Python中的深度学习:神经网络与卷积神经网络

当下&#xff0c;深度学习已经成为人工智能研究和应用领域的关键技术之一。作为一个开源的高级编程语言&#xff0c;Python提供了丰富的工具和库&#xff0c;为深度学习的研究和开发提供了便利。本文将深入探究Python中的深度学习&#xff0c;重点聚焦于神经网络与卷积神经网络…

【笔录】TVP技术沙龙:寻宝AI时代

目录 引言大模型的应用案例大模型三问模型落地可行性考量维度AIGC的几个可行应用方向AIGC的存储LLM工程应用范式演进LLM编程协作范式变化 引言 大模型是10倍的机会&#xff0c;但并不是平均主义的机会&#xff0c;没有低垂的果实。 企业想在大模型的赛道上跑出成绩&#xff0c;…

React 生成传递给无障碍属性的唯一 ID

useId() 在组件的顶层调用 useId 生成唯一 ID&#xff1a; import { useId } from react; function PasswordField() { const passwordHintId useId(); // ...参数 useId 不带任何参数。 返回值 useId 返回一个唯一的字符串 ID&#xff0c;与此特定组件中的 useI…

【jenkins】centos7在线安装jenkins

一、系统要求 最低推荐配置 256MB可用内存 1GB可用磁盘空间(作为一个Docker容器运行jenkins的话推荐10GB) 软件配置 Java 8—​无论是Java运行时环境&#xff08;JRE&#xff09;还是Java开发工具包&#xff08;JDK&#xff09;都可以 二、安装jenkins 准备一台安装有ce…

ALS算法在菜品智能推荐系统的应用

核心推荐模块的推荐算法是基于用户推荐模 型&#xff08;user_model&#xff09;协同过滤的矩阵分解过滤算法 ALS。其算法原理可叙述为&#xff1a; ALS收集大数据样本的用户评分喜好信息&#xff0c;训 练推荐模型&#xff0c;基于该模型进行协同过滤。 对于任意一个形如用户-…

Spring体系结构

Spring体系结构 核心容器 核心容器由 spring-core&#xff0c;spring-beans&#xff0c;spring-context&#xff0c;spring-context-support和spring-expression&#xff08;SpEL&#xff0c;Spring 表达式语言&#xff0c;Spring Expression Language&#xff09;等模块组成&…

保护自己免受AI诈骗的方法

前言 在21世纪&#xff0c;人工智能已经成为我们日常生活的一部分。不仅在聊天、写作、绘画和编程领域展现了巨大的潜力&#xff0c;还改变了我们的生活方式&#xff0c;提供了便捷和创新。然而&#xff0c;随着这一技术的迅速发展&#xff0c;我们也不得不面对新的威胁&#…

SQL中:语法总结(group by,having ,distinct,top,order by,like等等)

语法总结&#xff1a;group by&#xff0c;distinct ...... 1.分组group by、条件havinggroup byhaving 2.聚集函数count 3.order by4.对表中数据的操作&#xff1a;增insert、删delete、改update增insert 5.对表中数据的操作&#xff1a;查select嵌套查询不相关子查询相关子查…

【深度学习】吴恩达课程笔记(二)——浅层神经网络、深层神经网络

笔记为自我总结整理的学习笔记&#xff0c;若有错误欢迎指出哟~ 笔记链接 【深度学习】吴恩达课程笔记(一)——深度学习概论、神经网络基础 吴恩达课程笔记——浅层神经网络、深层神经网络 四、浅层神经网络1.双层神经网络表示2.双层神经网络的前向传播第一层前向传播第二层前…

IP协议详解

IP协议处于五层模型&#xff08;也可以说七层模型&#xff09;中的网络层&#xff0c;网络层的主要任务是实现网络互连&#xff0c;进而实现数据包在各网络之间的传输。上一篇文章中我们讲到了TCP&#xff08;传输层&#xff09;会认为它负责将数据从一个设备传输到另一个设备&…

Java 将list集合的字符串格式转为Map

Java 将list集合的字符串格式转为Map List<Object> list new ArrayList<>(); Map<String,String> map1 new HashMap<>(); map1.put("fileName","测试1"); map1.put("level","1"); list.add(map1);Map<S…

【C语言】文件操作详解

&#x1f388;个人主页&#xff1a;.满船清梦压星河_-CSDN博客 &#x1f302;c领域新星创作者 &#x1f389;欢迎&#x1f44d;点赞✍评论❤️收藏 &#x1f61b;&#x1f61b;&#x1f61b;希望我的文章能对你有所帮助&#xff0c;有不足的地方还请各位看官多多指教&#xff0…

docker的安装部署nginx和mysql

小白自己整理&#xff0c;如有错误请指示&#xff01; 自我理解&#xff1a;docker就是把应用程序所用的依赖程序&#xff0c;函数库等相关文件打包成镜像文件&#xff0c;类似系统光盘&#xff0c;然后可以在任意电脑上安装使用&#xff08;方便运维人员部署程序&#xff09;…

代码审计-锐捷EG易网关 管理员账号密码泄露漏洞

出现漏洞的文件在 /login.php 审查源码我们发现通过命令拼接的方式构造命令执行 发送请求包&#xff0c;拼接 CLI指令 show webmaster user /login.php usernameadmin&passwordadmin?showwebmasteruser漏洞证明&#xff1a; 文笔生疏&#xff0c;措辞浅薄&#xff0c;望…