一次Centos 7 下安装docker的完整安装日志过程

本文记录了一次在CentOS7上安装Docker的完整过程,包括遇到的Python版本错误导致的yum-config-manager问题,以及如何解决这个问题。在安装过程中,还涉及到了依赖包的更新和安装,如device-mapper、lvm2等。最终成功添加了Docker仓库,并安装了Docker CE及其相关组件。但在运行Docker时,提示需要启动Docker服务,启动后成功运行了一个示例容器。

一次Centos 7 下安装docker的完整安装日志过程

安装教程来源于
https://www.runoob.com/docker/centos-docker-install.html

期间遇到了一个问题。

问题描述:设置稳定的仓库报错 File “/bin/yum-config-manager”, line 135 except yum.Errors.RepoError, e:

原因:遇到这个错误是因为我升级了Python到3,但是yum-config-manager这个文件头的Python没有改成Python2,如下:

[root@miniserver ~]# python --version
Python 3.6.8
[root@miniserver ~]# 

解决方式:
[root@miniserver ~]# vim /usr/bin/yum-config-manager
将yum-config-manager这个文件头的Python改成Python2

这里记录一下安装日志,以供后期可能的问题排查比对。

[root@miniserver ~]# sudo yum install -y yum-utils \
>   device-mapper-persistent-data \
>   lvm2
已加载插件:fastestmirror, langpacks
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
base                                                                                                                                                                                                                                                   | 3.6 kB  00:00:00     
epel/x86_64/metalink                                                                                                                                                                                                                                   | 9.5 kB  00:00:00     
epel                                                                                                                                                                                                                                                   | 4.7 kB  00:00:00     
extras                                                                                                                                                                                                                                                 | 2.9 kB  00:00:00     
google-chrome                                                                                                                                                                                                                                          | 1.3 kB  00:00:00     
updates                                                                                                                                                                                                                                                | 2.9 kB  00:00:00     
(1/4): epel/x86_64/updateinfo                                                                                                                                                                                                                          | 1.0 MB  00:00:00     
(2/4): google-chrome/primary                                                                                                                                                                                                                           | 1.7 kB  00:00:00     
(3/4): epel/x86_64/primary_db                                                                                                                                                                                                                          | 7.0 MB  00:00:01     
(4/4): updates/7/x86_64/primary_db                                                                                                                                                                                                                     |  12 MB  00:00:02     
Determining fastest mirrors
 * base: mirrors.ustc.edu.cn
 * epel: hkg.mirror.rackspace.com
 * extras: mirrors.163.com
 * updates: mirrors.163.com
google-chrome                                                                                                                                                                                                                                                             3/3
正在解决依赖关系
--> 正在检查事务
---> 软件包 device-mapper-persistent-data.x86_64.0.0.6.3-1.el7 将被 升级
---> 软件包 device-mapper-persistent-data.x86_64.0.0.8.5-3.el7_9.2 将被 更新
---> 软件包 lvm2.x86_64.7.2.02.166-1.el7 将被 升级
---> 软件包 lvm2.x86_64.7.2.02.187-6.el7_9.5 将被 更新
--> 正在处理依赖关系 lvm2-libs = 7:2.02.187-6.el7_9.5,它被软件包 7:lvm2-2.02.187-6.el7_9.5.x86_64 需要
--> 正在处理依赖关系 libdevmapper.so.1.02(DM_1_02_141)(64bit),它被软件包 7:lvm2-2.02.187-6.el7_9.5.x86_64 需要
--> 正在处理依赖关系 libdevmapper.so.1.02(DM_1_02_138)(64bit),它被软件包 7:lvm2-2.02.187-6.el7_9.5.x86_64 需要
---> 软件包 yum-utils.noarch.0.1.1.31-40.el7 将被 升级
---> 软件包 yum-utils.noarch.0.1.1.31-54.el7_8 将被 更新
--> 正在检查事务
---> 软件包 device-mapper-libs.x86_64.7.1.02.135-1.el7 将被 升级
--> 正在处理依赖关系 device-mapper-libs = 7:1.02.135-1.el7,它被软件包 7:device-mapper-1.02.135-1.el7.x86_64 需要
---> 软件包 device-mapper-libs.x86_64.7.1.02.170-6.el7_9.5 将被 更新
---> 软件包 lvm2-libs.x86_64.7.2.02.166-1.el7 将被 升级
---> 软件包 lvm2-libs.x86_64.7.2.02.187-6.el7_9.5 将被 更新
--> 正在处理依赖关系 device-mapper-event = 7:1.02.170-6.el7_9.5,它被软件包 7:lvm2-libs-2.02.187-6.el7_9.5.x86_64 需要
--> 正在检查事务
---> 软件包 device-mapper.x86_64.7.1.02.135-1.el7 将被 升级
---> 软件包 device-mapper.x86_64.7.1.02.170-6.el7_9.5 将被 更新
---> 软件包 device-mapper-event.x86_64.7.1.02.135-1.el7 将被 升级
---> 软件包 device-mapper-event.x86_64.7.1.02.170-6.el7_9.5 将被 更新
--> 正在处理依赖关系 device-mapper-event-libs = 7:1.02.170-6.el7_9.5,它被软件包 7:device-mapper-event-1.02.170-6.el7_9.5.x86_64 需要
--> 正在检查事务
---> 软件包 device-mapper-event-libs.x86_64.7.1.02.135-1.el7 将被 升级
---> 软件包 device-mapper-event-libs.x86_64.7.1.02.170-6.el7_9.5 将被 更新
--> 解决依赖关系完成

依赖关系解决

==============================================================================================================================================================================================================================================================================
 Package                                                                        架构                                                    版本                                                                   源                                                        大小
==============================================================================================================================================================================================================================================================================
正在更新:
 device-mapper-persistent-data                                                  x86_64                                                  0.8.5-3.el7_9.2                                                        updates                                                  423 k
 lvm2                                                                           x86_64                                                  7:2.02.187-6.el7_9.5                                                   updates                                                  1.3 M
 yum-utils                                                                      noarch                                                  1.1.31-54.el7_8                                                        base                                                     122 k
为依赖而更新:
 device-mapper                                                                  x86_64                                                  7:1.02.170-6.el7_9.5                                                   updates                                                  297 k
 device-mapper-event                                                            x86_64                                                  7:1.02.170-6.el7_9.5                                                   updates                                                  192 k
 device-mapper-event-libs                                                       x86_64                                                  7:1.02.170-6.el7_9.5                                                   updates                                                  192 k
 device-mapper-libs                                                             x86_64                                                  7:1.02.170-6.el7_9.5                                                   updates                                                  325 k
 lvm2-libs                                                                      x86_64                                                  7:2.02.187-6.el7_9.5                                                   updates                                                  1.1 M

事务概要
==============================================================================================================================================================================================================================================================================
升级  3 软件包 (+5 依赖软件包)

总下载量:3.9 M
Downloading packages:
No Presto metadata available for base
No Presto metadata available for updates
(1/8): device-mapper-1.02.170-6.el7_9.5.x86_64.rpm                                                                                                                                                                                                     | 297 kB  00:00:00     
(2/8): device-mapper-event-1.02.170-6.el7_9.5.x86_64.rpm                                                                                                                                                                                               | 192 kB  00:00:00     
(3/8): device-mapper-event-libs-1.02.170-6.el7_9.5.x86_64.rpm                                                                                                                                                                                          | 192 kB  00:00:00     
(4/8): device-mapper-persistent-data-0.8.5-3.el7_9.2.x86_64.rpm                                                                                                                                                                                        | 423 kB  00:00:00     
(5/8): device-mapper-libs-1.02.170-6.el7_9.5.x86_64.rpm                                                                                                                                                                                                | 325 kB  00:00:00     
(6/8): lvm2-2.02.187-6.el7_9.5.x86_64.rpm                                                                                                                                                                                                              | 1.3 MB  00:00:00     
(7/8): lvm2-libs-2.02.187-6.el7_9.5.x86_64.rpm                                                                                                                                                                                                         | 1.1 MB  00:00:00     
(8/8): yum-utils-1.1.31-54.el7_8.noarch.rpm                                                                                                                                                                                                            | 122 kB  00:00:00     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                                                                                                                                          3.6 MB/s | 3.9 MB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在更新    : 7:device-mapper-libs-1.02.170-6.el7_9.5.x86_64                                                                                                                                                                                                           1/16 
  正在更新    : 7:device-mapper-1.02.170-6.el7_9.5.x86_64                                                                                                                                                                                                                2/16 
  正在更新    : 7:device-mapper-event-libs-1.02.170-6.el7_9.5.x86_64                                                                                                                                                                                                     3/16 
  正在更新    : 7:device-mapper-event-1.02.170-6.el7_9.5.x86_64                                                                                                                                                                                                          4/16 
  正在更新    : 7:lvm2-libs-2.02.187-6.el7_9.5.x86_64                                                                                                                                                                                                                    5/16 
  正在更新    : device-mapper-persistent-data-0.8.5-3.el7_9.2.x86_64                                                                                                                                                                                                     6/16 
  正在更新    : 7:lvm2-2.02.187-6.el7_9.5.x86_64                                                                                                                                                                                                                         7/16 
  正在更新    : yum-utils-1.1.31-54.el7_8.noarch                                                                                                                                                                                                                         8/16 
  清理        : 7:lvm2-2.02.166-1.el7.x86_64                                                                                                                                                                                                                             9/16 
  清理        : yum-utils-1.1.31-40.el7.noarch                                                                                                                                                                                                                          10/16 
  清理        : 7:lvm2-libs-2.02.166-1.el7.x86_64                                                                                                                                                                                                                       11/16 
  清理        : 7:device-mapper-event-1.02.135-1.el7.x86_64                                                                                                                                                                                                             12/16 
  清理        : 7:device-mapper-event-libs-1.02.135-1.el7.x86_64                                                                                                                                                                                                        13/16 
  清理        : 7:device-mapper-1.02.135-1.el7.x86_64                                                                                                                                                                                                                   14/16 
  清理        : 7:device-mapper-libs-1.02.135-1.el7.x86_64                                                                                                                                                                                                              15/16 
  清理        : device-mapper-persistent-data-0.6.3-1.el7.x86_64                                                                                                                                                                                                        16/16 
  验证中      : 7:device-mapper-event-1.02.170-6.el7_9.5.x86_64                                                                                                                                                                                                          1/16 
  验证中      : device-mapper-persistent-data-0.8.5-3.el7_9.2.x86_64                                                                                                                                                                                                     2/16 
  验证中      : 7:device-mapper-1.02.170-6.el7_9.5.x86_64                                                                                                                                                                                                                3/16 
  验证中      : 7:lvm2-libs-2.02.187-6.el7_9.5.x86_64                                                                                                                                                                                                                    4/16 
  验证中      : 7:device-mapper-event-libs-1.02.170-6.el7_9.5.x86_64                                                                                                                                                                                                     5/16 
  验证中      : 7:lvm2-2.02.187-6.el7_9.5.x86_64                                                                                                                                                                                                                         6/16 
  验证中      : 7:device-mapper-libs-1.02.170-6.el7_9.5.x86_64                                                                                                                                                                                                           7/16 
  验证中      : yum-utils-1.1.31-54.el7_8.noarch                                                                                                                                                                                                                         8/16 
  验证中      : 7:device-mapper-event-libs-1.02.135-1.el7.x86_64                                                                                                                                                                                                         9/16 
  验证中      : 7:device-mapper-libs-1.02.135-1.el7.x86_64                                                                                                                                                                                                              10/16 
  验证中      : 7:lvm2-2.02.166-1.el7.x86_64                                                                                                                                                                                                                            11/16 
  验证中      : yum-utils-1.1.31-40.el7.noarch                                                                                                                                                                                                                          12/16 
  验证中      : device-mapper-persistent-data-0.6.3-1.el7.x86_64                                                                                                                                                                                                        13/16 
  验证中      : 7:device-mapper-1.02.135-1.el7.x86_64                                                                                                                                                                                                                   14/16 
  验证中      : 7:lvm2-libs-2.02.166-1.el7.x86_64                                                                                                                                                                                                                       15/16 
  验证中      : 7:device-mapper-event-1.02.135-1.el7.x86_64                                                                                                                                                                                                             16/16 

更新完毕:
  device-mapper-persistent-data.x86_64 0:0.8.5-3.el7_9.2                                                 lvm2.x86_64 7:2.02.187-6.el7_9.5                                                 yum-utils.noarch 0:1.1.31-54.el7_8                                                

作为依赖被升级:
  device-mapper.x86_64 7:1.02.170-6.el7_9.5         device-mapper-event.x86_64 7:1.02.170-6.el7_9.5         device-mapper-event-libs.x86_64 7:1.02.170-6.el7_9.5         device-mapper-libs.x86_64 7:1.02.170-6.el7_9.5         lvm2-libs.x86_64 7:2.02.187-6.el7_9.5        

完毕!

[root@miniserver ~]# sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
  File "/bin/yum-config-manager", line 135
    except yum.Errors.RepoError, e:
                               ^
SyntaxError: invalid syntax
[root@miniserver ~]# 
[root@miniserver ~]# python --version
Python 3.6.8
[root@miniserver ~]# vim /usr/bin/yum-config-manager   ## 修改该文件为使用为python2
[root@miniserver ~]# sudo yum-config-manager --add-repo https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo
已加载插件:fastestmirror, langpacks
adding repo from: https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo
grabbing file https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
Could not fetch/save url https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo to file /etc/yum.repos.d/docker-ce.repo: [Errno 14] curl#60 - "The certificate issuer's certificate has expired. Check your system date and time."
[root@miniserver ~]# 
[root@miniserver ~]# date
2021年 11月 26日 星期五 09:29:17 CST
[root@miniserver ~]# sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
已加载插件:fastestmirror, langpacks
adding repo from: http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
[root@miniserver ~]# 
[root@miniserver ~]# sudo yum install docker-ce docker-ce-cli containerd.io
已加载插件:fastestmirror, langpacks
docker-ce-stable                                                                                                                                                                                                                                       | 3.5 kB  00:00:00     
(1/2): docker-ce-stable/7/x86_64/updateinfo                                                                                                                                                                                                            |   55 B  00:00:00     
(2/2): docker-ce-stable/7/x86_64/primary_db                                                                                                                                                                                                            |  69 kB  00:00:00     
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * epel: hkg.mirror.rackspace.com
 * extras: mirrors.163.com
 * updates: mirrors.163.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 containerd.io.x86_64.0.1.4.12-3.1.el7 将被 安装
--> 正在处理依赖关系 container-selinux >= 2:2.74,它被软件包 containerd.io-1.4.12-3.1.el7.x86_64 需要
---> 软件包 docker-ce.x86_64.3.20.10.11-3.el7 将被 安装
--> 正在处理依赖关系 docker-ce-rootless-extras,它被软件包 3:docker-ce-20.10.11-3.el7.x86_64 需要
---> 软件包 docker-ce-cli.x86_64.1.20.10.11-3.el7 将被 安装
--> 正在处理依赖关系 docker-scan-plugin(x86-64),它被软件包 1:docker-ce-cli-20.10.11-3.el7.x86_64 需要
--> 正在检查事务
---> 软件包 container-selinux.noarch.2.2.119.2-1.911c772.el7_8 将被 安装
--> 正在处理依赖关系 selinux-policy-targeted >= 3.13.1-216.el7,它被软件包 2:container-selinux-2.119.2-1.911c772.el7_8.noarch 需要
--> 正在处理依赖关系 selinux-policy-base >= 3.13.1-216.el7,它被软件包 2:container-selinux-2.119.2-1.911c772.el7_8.noarch 需要
--> 正在处理依赖关系 selinux-policy >= 3.13.1-216.el7,它被软件包 2:container-selinux-2.119.2-1.911c772.el7_8.noarch 需要
--> 正在处理依赖关系 policycoreutils >= 2.5-11,它被软件包 2:container-selinux-2.119.2-1.911c772.el7_8.noarch 需要
---> 软件包 docker-ce-rootless-extras.x86_64.0.20.10.11-3.el7 将被 安装
--> 正在处理依赖关系 fuse-overlayfs >= 0.7,它被软件包 docker-ce-rootless-extras-20.10.11-3.el7.x86_64 需要
--> 正在处理依赖关系 slirp4netns >= 0.4,它被软件包 docker-ce-rootless-extras-20.10.11-3.el7.x86_64 需要
---> 软件包 docker-scan-plugin.x86_64.0.0.9.0-3.el7 将被 安装
--> 正在检查事务
---> 软件包 fuse-overlayfs.x86_64.0.0.7.2-6.el7_8 将被 安装
--> 正在处理依赖关系 libfuse3.so.3(FUSE_3.2)(64bit),它被软件包 fuse-overlayfs-0.7.2-6.el7_8.x86_64 需要
--> 正在处理依赖关系 libfuse3.so.3(FUSE_3.0)(64bit),它被软件包 fuse-overlayfs-0.7.2-6.el7_8.x86_64 需要
--> 正在处理依赖关系 libfuse3.so.3()(64bit),它被软件包 fuse-overlayfs-0.7.2-6.el7_8.x86_64 需要
---> 软件包 policycoreutils.x86_64.0.2.5-8.el7 将被 升级
--> 正在处理依赖关系 policycoreutils = 2.5-8.el7,它被软件包 policycoreutils-python-2.5-8.el7.x86_64 需要
---> 软件包 policycoreutils.x86_64.0.2.5-34.el7 将被 更新
--> 正在处理依赖关系 libsemanage >= 2.5-14,它被软件包 policycoreutils-2.5-34.el7.x86_64 需要
---> 软件包 selinux-policy.noarch.0.3.13.1-102.el7 将被 升级
---> 软件包 selinux-policy.noarch.0.3.13.1-268.el7_9.2 将被 更新
---> 软件包 selinux-policy-targeted.noarch.0.3.13.1-102.el7 将被 升级
---> 软件包 selinux-policy-targeted.noarch.0.3.13.1-268.el7_9.2 将被 更新
---> 软件包 slirp4netns.x86_64.0.0.4.3-4.el7_8 将被 安装
--> 正在检查事务
---> 软件包 fuse3-libs.x86_64.0.3.6.1-4.el7 将被 安装
---> 软件包 libsemanage.x86_64.0.2.5-4.el7 将被 升级
--> 正在处理依赖关系 libsemanage = 2.5-4.el7,它被软件包 libsemanage-python-2.5-4.el7.x86_64 需要
---> 软件包 libsemanage.x86_64.0.2.5-14.el7 将被 更新
---> 软件包 policycoreutils-python.x86_64.0.2.5-8.el7 将被 升级
---> 软件包 policycoreutils-python.x86_64.0.2.5-34.el7 将被 更新
--> 正在处理依赖关系 setools-libs >= 3.3.8-4,它被软件包 policycoreutils-python-2.5-34.el7.x86_64 需要
--> 正在检查事务
---> 软件包 libsemanage-python.x86_64.0.2.5-4.el7 将被 升级
---> 软件包 libsemanage-python.x86_64.0.2.5-14.el7 将被 更新
---> 软件包 setools-libs.x86_64.0.3.3.8-1.1.el7 将被 升级
---> 软件包 setools-libs.x86_64.0.3.3.8-4.el7 将被 更新
--> 解决依赖关系完成
依赖关系解决
==============================================================================================================================================================================================================================================================================
 Package                                                                 架构                                                 版本                                                                       源                                                              大小
==============================================================================================================================================================================================================================================================================
正在安装:
 containerd.io                                                           x86_64                                               1.4.12-3.1.el7                                                             docker-ce-stable                                                28 M
 docker-ce                                                               x86_64                                               3:20.10.11-3.el7                                                           docker-ce-stable                                                23 M
 docker-ce-cli                                                           x86_64                                               1:20.10.11-3.el7                                                           docker-ce-stable                                                29 M
为依赖而安装:
 container-selinux                                                       noarch                                               2:2.119.2-1.911c772.el7_8                                                  extras                                                          40 k
 docker-ce-rootless-extras                                               x86_64                                               20.10.11-3.el7                                                             docker-ce-stable                                               8.0 M
 docker-scan-plugin                                                      x86_64                                               0.9.0-3.el7                                                                docker-ce-stable                                               3.7 M
 fuse-overlayfs                                                          x86_64                                               0.7.2-6.el7_8                                                              extras                                                          54 k
 fuse3-libs                                                              x86_64                                               3.6.1-4.el7                                                                extras                                                          82 k
 slirp4netns                                                             x86_64                                               0.4.3-4.el7_8                                                              extras                                                          81 k
为依赖而更新:
 libsemanage                                                             x86_64                                               2.5-14.el7                                                                 base                                                           151 k
 libsemanage-python                                                      x86_64                                               2.5-14.el7                                                                 base                                                           113 k
 policycoreutils                                                         x86_64                                               2.5-34.el7                                                                 base                                                           917 k
 policycoreutils-python                                                  x86_64                                               2.5-34.el7                                                                 base                                                           457 k
 selinux-policy                                                          noarch                                               3.13.1-268.el7_9.2                                                         updates                                                        498 k
 selinux-policy-targeted                                                 noarch                                               3.13.1-268.el7_9.2                                                         updates                                                        7.0 M
 setools-libs                                                            x86_64                                               3.3.8-4.el7                                                                base                                                           620 k
事务概要
==============================================================================================================================================================================================================================================================================
安装  3 软件包 (+6 依赖软件包)
升级           ( 7 依赖软件包)
总计:102 M
总下载量:100 M
Is this ok [y/d/N]: y
Downloading packages:
No Presto metadata available for updates
(1/11): container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm                                                                                                                                                                                           |  40 kB  00:00:00     
warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/docker-ce-20.10.11-3.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY=====                                                                                 ] 6.0 MB/s |  27 MB  00:00:12 ETA 
docker-ce-20.10.11-3.el7.x86_64.rpm 的公钥尚未安装
(2/11): docker-ce-20.10.11-3.el7.x86_64.rpm                                                                                                                                                                                                            |  23 MB  00:00:02     
(3/11): docker-ce-cli-20.10.11-3.el7.x86_64.rpm                                                                                                                                                                                                        |  29 MB  00:00:03     
(4/11): docker-ce-rootless-extras-20.10.11-3.el7.x86_64.rpm                                                                                                                                                                                            | 8.0 MB  00:00:01     
(5/11): fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm                                                                                                                                                                                                        |  54 kB  00:00:00     
(6/11): fuse3-libs-3.6.1-4.el7.x86_64.rpm                                                                                                                                                                                                              |  82 kB  00:00:00     
(7/11): slirp4netns-0.4.3-4.el7_8.x86_64.rpm                                                                                                                                                                                                           |  81 kB  00:00:00     
(8/11): docker-scan-plugin-0.9.0-3.el7.x86_64.rpm                                                                                                                                                                                                      | 3.7 MB  00:00:00     
(9/11): selinux-policy-3.13.1-268.el7_9.2.noarch.rpm                                                                                                                                                                                                   | 498 kB  00:00:00     
(10/11): containerd.io-1.4.12-3.1.el7.x86_64.rpm                                                                                                                                                                                                       |  28 MB  00:00:09     
(11/11): selinux-policy-targeted-3.13.1-268.el7_9.2.noarch.rpm                                                                                                                                                                                         | 7.0 MB  00:00:01     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                                                                                                                                           11 MB/s | 100 MB  00:00:09     
从 https://mirrors.aliyun.com/docker-ce/linux/centos/gpg 检索密钥
导入 GPG key 0x621E9F35:
 用户ID     : "Docker Release (CE rpm) <docker@docker.com>"
 指纹       : 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
 来自       : https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
是否继续?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在更新    : libsemanage-2.5-14.el7.x86_64                                                                                                                                                                                                                            1/23 
  正在更新    : policycoreutils-2.5-34.el7.x86_64                                                                                                                                                                                                                        2/23 
  正在更新    : selinux-policy-3.13.1-268.el7_9.2.noarch                                                                                                                                                                                                                 3/23 
  正在更新    : selinux-policy-targeted-3.13.1-268.el7_9.2.noarch                                                                                                                                                                                                        4/23 
  正在更新    : libsemanage-python-2.5-14.el7.x86_64                                                                                                                                                                                                                     5/23 
  正在安装    : 1:docker-ce-cli-20.10.11-3.el7.x86_64                                                                                                                                                                                                                    6/23 
  正在安装    : docker-scan-plugin-0.9.0-3.el7.x86_64                                                                                                                                                                                                                    7/23 
  正在安装    : slirp4netns-0.4.3-4.el7_8.x86_64                                                                                                                                                                                                                         8/23 
  正在安装    : fuse3-libs-3.6.1-4.el7.x86_64                                                                                                                                                                                                                            9/23 
  正在安装    : fuse-overlayfs-0.7.2-6.el7_8.x86_64                                                                                                                                                                                                                     10/23 
  正在更新    : setools-libs-3.3.8-4.el7.x86_64                                                                                                                                                                                                                         11/23 
  正在更新    : policycoreutils-python-2.5-34.el7.x86_64                                                                                                                                                                                                                12/23 
  正在安装    : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch                                                                                                                                                                                                      13/23 
  正在安装    : containerd.io-1.4.12-3.1.el7.x86_64                                                                                                                                                                                                                     14/23 
  正在安装    : 3:docker-ce-20.10.11-3.el7.x86_64                                                                                                                                                                                                                       15/23 
  正在安装    : docker-ce-rootless-extras-20.10.11-3.el7.x86_64                                                                                                                                                                                                         16/23 
  清理        : selinux-policy-targeted-3.13.1-102.el7.noarch                                                                                                                                                                                                           17/23 
  清理        : policycoreutils-python-2.5-8.el7.x86_64                                                                                                                                                                                                                 18/23 
  清理        : selinux-policy-3.13.1-102.el7.noarch                                                                                                                                                                                                                    19/23 
  清理        : policycoreutils-2.5-8.el7.x86_64                                                                                                                                                                                                                        20/23 
  清理        : libsemanage-python-2.5-4.el7.x86_64                                                                                                                                                                                                                     21/23 
  清理        : libsemanage-2.5-4.el7.x86_64                                                                                                                                                                                                                            22/23 
  清理        : setools-libs-3.3.8-1.1.el7.x86_64                                                                                                                                                                                                                       23/23 
  验证中      : fuse-overlayfs-0.7.2-6.el7_8.x86_64                                                                                                                                                                                                                      1/23 
  验证中      : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch                                                                                                                                                                                                       2/23 
  验证中      : docker-ce-rootless-extras-20.10.11-3.el7.x86_64                                                                                                                                                                                                          3/23 
  验证中      : selinux-policy-targeted-3.13.1-268.el7_9.2.noarch                                                                                                                                                                                                        4/23 
  验证中      : policycoreutils-2.5-34.el7.x86_64                                                                                                                                                                                                                        5/23 
  验证中      : policycoreutils-python-2.5-34.el7.x86_64                                                                                                                                                                                                                 6/23 
  验证中      : setools-libs-3.3.8-4.el7.x86_64                                                                                                                                                                                                                          7/23 
  验证中      : docker-scan-plugin-0.9.0-3.el7.x86_64                                                                                                                                                                                                                    8/23 
  验证中      : fuse3-libs-3.6.1-4.el7.x86_64                                                                                                                                                                                                                            9/23 
  验证中      : libsemanage-python-2.5-14.el7.x86_64                                                                                                                                                                                                                    10/23 
  验证中      : containerd.io-1.4.12-3.1.el7.x86_64                                                                                                                                                                                                                     11/23 
  验证中      : libsemanage-2.5-14.el7.x86_64                                                                                                                                                                                                                           12/23 
  验证中      : slirp4netns-0.4.3-4.el7_8.x86_64                                                                                                                                                                                                                        13/23 
  验证中      : 3:docker-ce-20.10.11-3.el7.x86_64                                                                                                                                                                                                                       14/23 
  验证中      : selinux-policy-3.13.1-268.el7_9.2.noarch                                                                                                                                                                                                                15/23 
  验证中      : 1:docker-ce-cli-20.10.11-3.el7.x86_64                                                                                                                                                                                                                   16/23 
  验证中      : policycoreutils-2.5-8.el7.x86_64                                                                                                                                                                                                                        17/23 
  验证中      : libsemanage-python-2.5-4.el7.x86_64                                                                                                                                                                                                                     18/23 
  验证中      : policycoreutils-python-2.5-8.el7.x86_64                                                                                                                                                                                                                 19/23 
  验证中      : selinux-policy-3.13.1-102.el7.noarch                                                                                                                                                                                                                    20/23 
  验证中      : selinux-policy-targeted-3.13.1-102.el7.noarch                                                                                                                                                                                                           21/23 
  验证中      : libsemanage-2.5-4.el7.x86_64                                                                                                                                                                                                                            22/23 
  验证中      : setools-libs-3.3.8-1.1.el7.x86_64                                                                                                                                                                                                                       23/23 
已安装:
  containerd.io.x86_64 0:1.4.12-3.1.el7                                                      docker-ce.x86_64 3:20.10.11-3.el7                                                      docker-ce-cli.x86_64 1:20.10.11-3.el7                                                     
作为依赖被安装:
  container-selinux.noarch 2:2.119.2-1.911c772.el7_8    docker-ce-rootless-extras.x86_64 0:20.10.11-3.el7    docker-scan-plugin.x86_64 0:0.9.0-3.el7    fuse-overlayfs.x86_64 0:0.7.2-6.el7_8    fuse3-libs.x86_64 0:3.6.1-4.el7    slirp4netns.x86_64 0:0.4.3-4.el7_8   
作为依赖被升级:
  libsemanage.x86_64 0:2.5-14.el7      libsemanage-python.x86_64 0:2.5-14.el7    policycoreutils.x86_64 0:2.5-34.el7    policycoreutils-python.x86_64 0:2.5-34.el7    selinux-policy.noarch 0:3.13.1-268.el7_9.2    selinux-policy-targeted.noarch 0:3.13.1-268.el7_9.2   
  setools-libs.x86_64 0:3.3.8-4.el7   
完毕!
[root@miniserver ~]# yum list docker-ce --showduplicates | sort -r
已加载插件:fastestmirror, langpacks
已安装的软件包
可安装的软件包
 * updates: mirrors.163.com
Loading mirror speeds from cached hostfile
 * extras: mirrors.163.com
 * epel: hkg.mirror.rackspace.com
docker-ce.x86_64            3:20.10.9-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:20.10.8-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:20.10.7-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:20.10.6-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:20.10.5-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:20.10.4-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:20.10.3-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:20.10.2-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:20.10.1-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:20.10.11-3.el7                   docker-ce-stable 
docker-ce.x86_64            3:20.10.11-3.el7                   @docker-ce-stable
docker-ce.x86_64            3:20.10.10-3.el7                   docker-ce-stable 
docker-ce.x86_64            3:20.10.0-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:19.03.9-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:19.03.8-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:19.03.7-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:19.03.6-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:19.03.5-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:19.03.4-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:19.03.3-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:19.03.2-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:19.03.15-3.el7                   docker-ce-stable 
docker-ce.x86_64            3:19.03.14-3.el7                   docker-ce-stable 
docker-ce.x86_64            3:19.03.1-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:19.03.13-3.el7                   docker-ce-stable 
docker-ce.x86_64            3:19.03.12-3.el7                   docker-ce-stable 
docker-ce.x86_64            3:19.03.11-3.el7                   docker-ce-stable 
docker-ce.x86_64            3:19.03.10-3.el7                   docker-ce-stable 
docker-ce.x86_64            3:19.03.0-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:18.09.9-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:18.09.8-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:18.09.7-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:18.09.6-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:18.09.5-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:18.09.4-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:18.09.3-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:18.09.2-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:18.09.1-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:18.09.0-3.el7                    docker-ce-stable 
docker-ce.x86_64            18.06.3.ce-3.el7                   docker-ce-stable 
docker-ce.x86_64            18.06.2.ce-3.el7                   docker-ce-stable 
docker-ce.x86_64            18.06.1.ce-3.el7                   docker-ce-stable 
docker-ce.x86_64            18.06.0.ce-3.el7                   docker-ce-stable 
docker-ce.x86_64            18.03.1.ce-1.el7.centos            docker-ce-stable 
docker-ce.x86_64            18.03.0.ce-1.el7.centos            docker-ce-stable 
docker-ce.x86_64            17.12.1.ce-1.el7.centos            docker-ce-stable 
docker-ce.x86_64            17.12.0.ce-1.el7.centos            docker-ce-stable 
docker-ce.x86_64            17.09.1.ce-1.el7.centos            docker-ce-stable 
docker-ce.x86_64            17.09.0.ce-1.el7.centos            docker-ce-stable 
docker-ce.x86_64            17.06.2.ce-1.el7.centos            docker-ce-stable 
docker-ce.x86_64            17.06.1.ce-1.el7.centos            docker-ce-stable 
docker-ce.x86_64            17.06.0.ce-1.el7.centos            docker-ce-stable 
docker-ce.x86_64            17.03.3.ce-1.el7                   docker-ce-stable 
docker-ce.x86_64            17.03.2.ce-1.el7.centos            docker-ce-stable 
docker-ce.x86_64            17.03.1.ce-1.el7.centos            docker-ce-stable 
docker-ce.x86_64            17.03.0.ce-1.el7.centos            docker-ce-stable 
 * base: mirrors.ustc.edu.cn
[root@miniserver ~]
[root@miniserver ~]# sudo docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
[root@miniserver ~]
[root@miniserver ~]# sudo systemctl start docker

[root@miniserver ~]# sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete 
Digest: sha256:cc15c5b292d8525effc0f89cb299f1804f3a725c8d05e158653a563f15e4f685
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

[root@miniserver ~]# 

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值