CentOS 7 快速部署Docker-CE环境(阿里云版) | IT运维网
  • 本站启用了账户登录密码错误就锁定模式,如有人误操作被锁请邮件(yvan.lu@ityww.cn)告知我账户名。
  • 本站为个人技术性站点,上面会更新一些系统、网络、虚拟化及云计算等相关的文章,与大家一起参考、学习和交流。
  • 欢迎访问本网站;本站QQ交流群:654792529;如果您觉得本站非常有看点,那么赶紧使用Ctrl+D收藏吧!

CentOS 7 快速部署Docker-CE环境(阿里云版)

Docker yvan 来源:阿里云 3年前 (2021-02-27) 3329次浏览 已收录 0个评论 扫描二维码

1、安装必要的一些系统工具:yum install -y yum-utils device-mapper-persistent-data lvm2

[root@localhost ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                                                                                                                                       | 3.6 kB  00:00:00     
epel                                                                                                                                                                                       | 4.7 kB  00:00:00     
extras                                                                                                                                                                                     | 2.9 kB  00:00:00     
updates                                                                                                                                                                                    | 2.9 kB  00:00:00     
(1/3): extras/7/x86_64/primary_db                                                                                                                                                          | 225 kB  00:00:00     
(2/3): epel/x86_64/updateinfo                                                                                                                                                              | 1.0 MB  00:00:00     
(3/3): epel/x86_64/primary_db                                                                                                                                                              | 6.9 MB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package device-mapper-persistent-data.x86_64 0:0.8.5-3.el7_9.2 will be installed
--> Processing Dependency: libaio.so.1(LIBAIO_0.4)(64bit) for package: device-mapper-persistent-data-0.8.5-3.el7_9.2.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.1)(64bit) for package: device-mapper-persistent-data-0.8.5-3.el7_9.2.x86_64
--> Processing Dependency: libaio.so.1()(64bit) for package: device-mapper-persistent-data-0.8.5-3.el7_9.2.x86_64
---> Package lvm2.x86_64 7:2.02.187-6.el7_9.3 will be installed
--> Processing Dependency: lvm2-libs = 7:2.02.187-6.el7_9.3 for package: 7:lvm2-2.02.187-6.el7_9.3.x86_64
--> Processing Dependency: liblvm2app.so.2.2(Base)(64bit) for package: 7:lvm2-2.02.187-6.el7_9.3.x86_64
--> Processing Dependency: libdevmapper-event.so.1.02(Base)(64bit) for package: 7:lvm2-2.02.187-6.el7_9.3.x86_64
--> Processing Dependency: liblvm2app.so.2.2()(64bit) for package: 7:lvm2-2.02.187-6.el7_9.3.x86_64
--> Processing Dependency: libdevmapper-event.so.1.02()(64bit) for package: 7:lvm2-2.02.187-6.el7_9.3.x86_64
---> Package yum-utils.noarch 0:1.1.31-54.el7_8 will be installed
--> Processing Dependency: python-kitchen for package: yum-utils-1.1.31-54.el7_8.noarch
--> Running transaction check
---> Package device-mapper-event-libs.x86_64 7:1.02.170-6.el7_9.3 will be installed
---> Package libaio.x86_64 0:0.3.109-13.el7 will be installed
---> Package lvm2-libs.x86_64 7:2.02.187-6.el7_9.3 will be installed
--> Processing Dependency: device-mapper-event = 7:1.02.170-6.el7_9.3 for package: 7:lvm2-libs-2.02.187-6.el7_9.3.x86_64
---> Package python-kitchen.noarch 0:1.1.1-5.el7 will be installed
--> Processing Dependency: python-chardet for package: python-kitchen-1.1.1-5.el7.noarch
--> Running transaction check
---> Package device-mapper-event.x86_64 7:1.02.170-6.el7_9.3 will be installed
---> Package python-chardet.noarch 0:2.2.1-3.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================================================================================
 Package                                                         Arch                                     Version                                                 Repository                                 Size
==================================================================================================================================================================================================================
Installing:
 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.3                                    updates                                   1.3 M
 yum-utils                                                       noarch                                   1.1.31-54.el7_8                                         base                                      122 k
Installing for dependencies:
 device-mapper-event                                             x86_64                                   7:1.02.170-6.el7_9.3                                    updates                                   192 k
 device-mapper-event-libs                                        x86_64                                   7:1.02.170-6.el7_9.3                                    updates                                   191 k
 libaio                                                          x86_64                                   0.3.109-13.el7                                          base                                       24 k
 lvm2-libs                                                       x86_64                                   7:2.02.187-6.el7_9.3                                    updates                                   1.1 M
 python-chardet                                                  noarch                                   2.2.1-3.el7                                             base                                      227 k
 python-kitchen                                                  noarch                                   1.1.1-5.el7                                             base                                      267 k

Transaction Summary
==================================================================================================================================================================================================================
Install  3 Packages (+6 Dependent packages)

Total download size: 3.8 M
Installed size: 11 M
Downloading packages:
(1/9): device-mapper-event-1.02.170-6.el7_9.3.x86_64.rpm                                                                                                                                   | 192 kB  00:00:00     
(2/9): device-mapper-event-libs-1.02.170-6.el7_9.3.x86_64.rpm                                                                                                                              | 191 kB  00:00:00     
(3/9): device-mapper-persistent-data-0.8.5-3.el7_9.2.x86_64.rpm                                                                                                                            | 423 kB  00:00:00     
(4/9): lvm2-libs-2.02.187-6.el7_9.3.x86_64.rpm                                                                                                                                             | 1.1 MB  00:00:00     
(5/9): libaio-0.3.109-13.el7.x86_64.rpm                                                                                                                                                    |  24 kB  00:00:00     
(6/9): lvm2-2.02.187-6.el7_9.3.x86_64.rpm                                                                                                                                                  | 1.3 MB  00:00:00     
(7/9): python-kitchen-1.1.1-5.el7.noarch.rpm                                                                                                                                               | 267 kB  00:00:00     
(8/9): yum-utils-1.1.31-54.el7_8.noarch.rpm                                                                                                                                                | 122 kB  00:00:00     
(9/9): python-chardet-2.2.1-3.el7.noarch.rpm                                                                                                                                               | 227 kB  00:00:00     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                             5.5 MB/s | 3.8 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libaio-0.3.109-13.el7.x86_64                                                                                                                                                                   1/9 
  Installing : 7:device-mapper-event-libs-1.02.170-6.el7_9.3.x86_64                                                                                                                                           2/9 
  Installing : 7:device-mapper-event-1.02.170-6.el7_9.3.x86_64                                                                                                                                                3/9 
  Installing : 7:lvm2-libs-2.02.187-6.el7_9.3.x86_64                                                                                                                                                          4/9 
  Installing : device-mapper-persistent-data-0.8.5-3.el7_9.2.x86_64                                                                                                                                           5/9 
  Installing : python-chardet-2.2.1-3.el7.noarch                                                                                                                                                              6/9 
  Installing : python-kitchen-1.1.1-5.el7.noarch                                                                                                                                                              7/9 
  Installing : yum-utils-1.1.31-54.el7_8.noarch                                                                                                                                                               8/9 
  Installing : 7:lvm2-2.02.187-6.el7_9.3.x86_64                                                                                                                                                               9/9 
  Verifying  : 7:device-mapper-event-libs-1.02.170-6.el7_9.3.x86_64                                                                                                                                           1/9 
  Verifying  : python-chardet-2.2.1-3.el7.noarch                                                                                                                                                              2/9 
  Verifying  : 7:device-mapper-event-1.02.170-6.el7_9.3.x86_64                                                                                                                                                3/9 
  Verifying  : device-mapper-persistent-data-0.8.5-3.el7_9.2.x86_64                                                                                                                                           4/9 
  Verifying  : python-kitchen-1.1.1-5.el7.noarch                                                                                                                                                              5/9 
  Verifying  : 7:lvm2-libs-2.02.187-6.el7_9.3.x86_64                                                                                                                                                          6/9 
  Verifying  : libaio-0.3.109-13.el7.x86_64                                                                                                                                                                   7/9 
  Verifying  : yum-utils-1.1.31-54.el7_8.noarch                                                                                                                                                               8/9 
  Verifying  : 7:lvm2-2.02.187-6.el7_9.3.x86_64                                                                                                                                                               9/9 

Installed:
  device-mapper-persistent-data.x86_64 0:0.8.5-3.el7_9.2                             lvm2.x86_64 7:2.02.187-6.el7_9.3                             yum-utils.noarch 0:1.1.31-54.el7_8                            

Dependency Installed:
  device-mapper-event.x86_64 7:1.02.170-6.el7_9.3 device-mapper-event-libs.x86_64 7:1.02.170-6.el7_9.3 libaio.x86_64 0:0.3.109-13.el7 lvm2-libs.x86_64 7:2.02.187-6.el7_9.3 python-chardet.noarch 0:2.2.1-3.el7
  python-kitchen.noarch 0:1.1.1-5.el7            

Complete!

2:、添加软件源信息:
yum-config-manager –add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sed -i ‘s+download.docker.com+mirrors.aliyun.com/docker-ce+’ /etc/yum.repos.d/docker-ce.repo

[root@localhost ~]# yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Loaded plugins: fastestmirror
adding repo from: https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file https://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@localhost ~]# sed -i 's+download.docker.com+mirrors.aliyun.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo

3、快读更新缓存并安装Docker-CE(默认安装最新的软件版本):yum makecache fast && yum install -y docker-ce

[root@localhost ~]# yum makecache fast && yum install -y docker-ce
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                                                                                                                                       | 3.6 kB  00:00:00     
docker-ce-stable                                                                                                                                                                           | 3.5 kB  00:00:00     
epel                                                                                                                                                                                       | 4.7 kB  00:00:00     
extras                                                                                                                                                                                     | 2.9 kB  00:00:00     
updates                                                                                                                                                                                    | 2.9 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                                                                                                                                                |  55 kB  00:00:00     
Metadata Cache Created
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package docker-ce.x86_64 3:20.10.3-3.el7 will be installed
--> Processing Dependency: container-selinux >= 2:2.74 for package: 3:docker-ce-20.10.3-3.el7.x86_64
--> Processing Dependency: containerd.io >= 1.4.1 for package: 3:docker-ce-20.10.3-3.el7.x86_64
--> Processing Dependency: docker-ce-cli for package: 3:docker-ce-20.10.3-3.el7.x86_64
--> Processing Dependency: docker-ce-rootless-extras for package: 3:docker-ce-20.10.3-3.el7.x86_64
--> Processing Dependency: libcgroup for package: 3:docker-ce-20.10.3-3.el7.x86_64
--> Running transaction check
---> Package container-selinux.noarch 2:2.119.2-1.911c772.el7_8 will be installed
--> Processing Dependency: policycoreutils-python for package: 2:container-selinux-2.119.2-1.911c772.el7_8.noarch
---> Package containerd.io.x86_64 0:1.4.3-3.1.el7 will be installed
---> Package docker-ce-cli.x86_64 1:20.10.3-3.el7 will be installed
---> Package docker-ce-rootless-extras.x86_64 0:20.10.3-3.el7 will be installed
--> Processing Dependency: fuse-overlayfs >= 0.7 for package: docker-ce-rootless-extras-20.10.3-3.el7.x86_64
--> Processing Dependency: slirp4netns >= 0.4 for package: docker-ce-rootless-extras-20.10.3-3.el7.x86_64
---> Package libcgroup.x86_64 0:0.41-21.el7 will be installed
--> Running transaction check
---> Package fuse-overlayfs.x86_64 0:0.7.2-6.el7_8 will be installed
--> Processing Dependency: libfuse3.so.3(FUSE_3.2)(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64
--> Processing Dependency: libfuse3.so.3(FUSE_3.0)(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64
--> Processing Dependency: libfuse3.so.3()(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64
---> Package policycoreutils-python.x86_64 0:2.5-34.el7 will be installed
--> Processing Dependency: setools-libs >= 3.3.8-4 for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libsemanage-python >= 2.5-14 for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: audit-libs-python >= 2.1.3-4 for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: python-IPy for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.4)(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.2)(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libapol.so.4(VERS_4.0)(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: checkpolicy for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libqpol.so.1()(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libapol.so.4()(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
---> Package slirp4netns.x86_64 0:0.4.3-4.el7_8 will be installed
--> Running transaction check
---> Package audit-libs-python.x86_64 0:2.8.5-4.el7 will be installed
---> Package checkpolicy.x86_64 0:2.5-8.el7 will be installed
---> Package fuse3-libs.x86_64 0:3.6.1-4.el7 will be installed
---> Package libsemanage-python.x86_64 0:2.5-14.el7 will be installed
---> Package python-IPy.noarch 0:0.75-6.el7 will be installed
---> Package setools-libs.x86_64 0:3.3.8-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================================================================================
 Package                                                  Arch                                  Version                                                     Repository                                       Size
==================================================================================================================================================================================================================
Installing:
 docker-ce                                                x86_64                                3:20.10.3-3.el7                                             docker-ce-stable                                 27 M
Installing for dependencies:
 audit-libs-python                                        x86_64                                2.8.5-4.el7                                                 base                                             76 k
 checkpolicy                                              x86_64                                2.5-8.el7                                                   base                                            295 k
 container-selinux                                        noarch                                2:2.119.2-1.911c772.el7_8                                   extras                                           40 k
 containerd.io                                            x86_64                                1.4.3-3.1.el7                                               docker-ce-stable                                 33 M
 docker-ce-cli                                            x86_64                                1:20.10.3-3.el7                                             docker-ce-stable                                 33 M
 docker-ce-rootless-extras                                x86_64                                20.10.3-3.el7                                               docker-ce-stable                                9.0 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
 libcgroup                                                x86_64                                0.41-21.el7                                                 base                                             66 k
 libsemanage-python                                       x86_64                                2.5-14.el7                                                  base                                            113 k
 policycoreutils-python                                   x86_64                                2.5-34.el7                                                  base                                            457 k
 python-IPy                                               noarch                                0.75-6.el7                                                  base                                             32 k
 setools-libs                                             x86_64                                3.3.8-4.el7                                                 base                                            620 k
 slirp4netns                                              x86_64                                0.4.3-4.el7_8                                               extras                                           81 k

Transaction Summary
==================================================================================================================================================================================================================
Install  1 Package (+14 Dependent packages)

Total download size: 104 M
Installed size: 428 M
Downloading packages:
(1/15): audit-libs-python-2.8.5-4.el7.x86_64.rpm                                                                                                                                           |  76 kB  00:00:00     
(2/15): container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm                                                                                                                               |  40 kB  00:00:00     
(3/15): checkpolicy-2.5-8.el7.x86_64.rpm                                                                                                                                                   | 295 kB  00:00:00     
warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/containerd.io-1.4.3-3.1.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY                       ] 8.5 MB/s |  52 MB  00:00:06 ETA 
Public key for containerd.io-1.4.3-3.1.el7.x86_64.rpm is not installed
(4/15): containerd.io-1.4.3-3.1.el7.x86_64.rpm                                                                                                                                             |  33 MB  00:00:05     
(5/15): docker-ce-20.10.3-3.el7.x86_64.rpm                                                                                                                                                 |  27 MB  00:00:06     
(6/15): libcgroup-0.41-21.el7.x86_64.rpm                                                                                                                                                   |  66 kB  00:00:00     
(7/15): fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm                                                                                                                                            |  54 kB  00:00:00     
(8/15): fuse3-libs-3.6.1-4.el7.x86_64.rpm                                                                                                                                                  |  82 kB  00:00:00     
(9/15): libsemanage-python-2.5-14.el7.x86_64.rpm                                                                                                                                           | 113 kB  00:00:00     
(10/15): python-IPy-0.75-6.el7.noarch.rpm                                                                                                                                                  |  32 kB  00:00:00     
(11/15): policycoreutils-python-2.5-34.el7.x86_64.rpm                                                                                                                                      | 457 kB  00:00:00     
(12/15): setools-libs-3.3.8-4.el7.x86_64.rpm                                                                                                                                               | 620 kB  00:00:00     
(13/15): slirp4netns-0.4.3-4.el7_8.x86_64.rpm                                                                                                                                              |  81 kB  00:00:00     
(14/15): docker-ce-rootless-extras-20.10.3-3.el7.x86_64.rpm                                                                                                                                | 9.0 MB  00:00:01     
(15/15): docker-ce-cli-20.10.3-3.el7.x86_64.rpm                                                                                                                                            |  33 MB  00:00:04     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                              10 MB/s | 104 MB  00:00:09     
Retrieving key from https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
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://mirrors.aliyun.com/docker-ce/linux/centos/gpg
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libcgroup-0.41-21.el7.x86_64                                                                                                                                                                  1/15 
  Installing : 1:docker-ce-cli-20.10.3-3.el7.x86_64                                                                                                                                                          2/15 
  Installing : setools-libs-3.3.8-4.el7.x86_64                                                                                                                                                               3/15 
  Installing : audit-libs-python-2.8.5-4.el7.x86_64                                                                                                                                                          4/15 
  Installing : python-IPy-0.75-6.el7.noarch                                                                                                                                                                  5/15 
  Installing : slirp4netns-0.4.3-4.el7_8.x86_64                                                                                                                                                              6/15 
  Installing : libsemanage-python-2.5-14.el7.x86_64                                                                                                                                                          7/15 
  Installing : fuse3-libs-3.6.1-4.el7.x86_64                                                                                                                                                                 8/15 
  Installing : fuse-overlayfs-0.7.2-6.el7_8.x86_64                                                                                                                                                           9/15 
  Installing : checkpolicy-2.5-8.el7.x86_64                                                                                                                                                                 10/15 
  Installing : policycoreutils-python-2.5-34.el7.x86_64                                                                                                                                                     11/15 
  Installing : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch                                                                                                                                           12/15 
setsebool:  SELinux is disabled.
  Installing : containerd.io-1.4.3-3.1.el7.x86_64                                                                                                                                                           13/15 
  Installing : docker-ce-rootless-extras-20.10.3-3.el7.x86_64                                                                                                                                               14/15 
  Installing : 3:docker-ce-20.10.3-3.el7.x86_64                                                                                                                                                             15/15 
  Verifying  : checkpolicy-2.5-8.el7.x86_64                                                                                                                                                                  1/15 
  Verifying  : fuse3-libs-3.6.1-4.el7.x86_64                                                                                                                                                                 2/15 
  Verifying  : 3:docker-ce-20.10.3-3.el7.x86_64                                                                                                                                                              3/15 
  Verifying  : fuse-overlayfs-0.7.2-6.el7_8.x86_64                                                                                                                                                           4/15 
  Verifying  : libsemanage-python-2.5-14.el7.x86_64                                                                                                                                                          5/15 
  Verifying  : slirp4netns-0.4.3-4.el7_8.x86_64                                                                                                                                                              6/15 
  Verifying  : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch                                                                                                                                            7/15 
  Verifying  : python-IPy-0.75-6.el7.noarch                                                                                                                                                                  8/15 
  Verifying  : containerd.io-1.4.3-3.1.el7.x86_64                                                                                                                                                            9/15 
  Verifying  : policycoreutils-python-2.5-34.el7.x86_64                                                                                                                                                     10/15 
  Verifying  : docker-ce-rootless-extras-20.10.3-3.el7.x86_64                                                                                                                                               11/15 
  Verifying  : audit-libs-python-2.8.5-4.el7.x86_64                                                                                                                                                         12/15 
  Verifying  : setools-libs-3.3.8-4.el7.x86_64                                                                                                                                                              13/15 
  Verifying  : 1:docker-ce-cli-20.10.3-3.el7.x86_64                                                                                                                                                         14/15 
  Verifying  : libcgroup-0.41-21.el7.x86_64                                                                                                                                                                 15/15 

Installed:
  docker-ce.x86_64 3:20.10.3-3.el7                                                                                                                                                                                

Dependency Installed:
  audit-libs-python.x86_64 0:2.8.5-4.el7         checkpolicy.x86_64 0:2.5-8.el7                           container-selinux.noarch 2:2.119.2-1.911c772.el7_8         containerd.io.x86_64 0:1.4.3-3.1.el7        
  docker-ce-cli.x86_64 1:20.10.3-3.el7           docker-ce-rootless-extras.x86_64 0:20.10.3-3.el7         fuse-overlayfs.x86_64 0:0.7.2-6.el7_8                      fuse3-libs.x86_64 0:3.6.1-4.el7             
  libcgroup.x86_64 0:0.41-21.el7                 libsemanage-python.x86_64 0:2.5-14.el7                   policycoreutils-python.x86_64 0:2.5-34.el7                 python-IPy.noarch 0:0.75-6.el7              
  setools-libs.x86_64 0:3.3.8-4.el7              slirp4netns.x86_64 0:0.4.3-4.el7_8                      

Complete!

4、 开启Docker服务并配置服务自启动:systemctl start docker.service && systemctl enable docker.service

[root@localhost ~]# systemctl start docker.service && systemctl enable docker.service
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

5、验证Docker服务安装状态:

[root@localhost ~]# systemctl status docker.service        #查看服务运行状态
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2021-02-27 23:46:05 CST; 27s ago
     Docs: https://docs.docker.com
 Main PID: 1877 (dockerd)
   CGroup: /system.slice/docker.service
           └─1877 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Feb 27 23:46:05 localhost.localdomain dockerd[1877]: time="2021-02-27T23:46:05.181233540+08:00" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
Feb 27 23:46:05 localhost.localdomain dockerd[1877]: time="2021-02-27T23:46:05.181253273+08:00" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock..." module=grpc
Feb 27 23:46:05 localhost.localdomain dockerd[1877]: time="2021-02-27T23:46:05.181261778+08:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Feb 27 23:46:05 localhost.localdomain dockerd[1877]: time="2021-02-27T23:46:05.228591969+08:00" level=info msg="Loading containers: start."
Feb 27 23:46:05 localhost.localdomain dockerd[1877]: time="2021-02-27T23:46:05.373071809+08:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon opti...d IP address"
Feb 27 23:46:05 localhost.localdomain dockerd[1877]: time="2021-02-27T23:46:05.418467843+08:00" level=info msg="Loading containers: done."
Feb 27 23:46:05 localhost.localdomain dockerd[1877]: time="2021-02-27T23:46:05.456819675+08:00" level=info msg="Docker daemon" commit=46229ca graphdriver(s)=overlay2 version=20.10.3
Feb 27 23:46:05 localhost.localdomain dockerd[1877]: time="2021-02-27T23:46:05.456928841+08:00" level=info msg="Daemon has completed initialization"
Feb 27 23:46:05 localhost.localdomain systemd[1]: Started Docker Application Container Engine.
Feb 27 23:46:05 localhost.localdomain dockerd[1877]: time="2021-02-27T23:46:05.533500806+08:00" level=info msg="API listen on /var/run/docker.sock"
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# docker version        #查看Docker版本信息
Client: Docker Engine - Community
 Version:           20.10.3
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        48d30b5
 Built:             Fri Jan 29 14:34:14 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.3
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       46229ca
  Built:            Fri Jan 29 14:32:37 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.3
  GitCommit:        269548fa27e0089a8b8278fc4fc781d7f65a939b
 runc:
  Version:          1.0.0-rc92
  GitCommit:        ff819c7e9184c13b7c2607fe6c30ae19403a7aff
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

CentOS 7 快速部署Docker-CE环境(阿里云版)
1、修改daemon配置文件(/etc/docker/daemon.json)来使用加速器

[root@localhost ~]# ll /etc/docker/
total 4
-rw------- 1 root root 244 Feb 27 23:46 key.json
[root@localhost ~]# tee /etc/docker/daemon.json <<-'EOF'
> {
>   "registry-mirrors": ["https://96x8i0tt.mirror.aliyuncs.com"]
> }
> EOF
{
  "registry-mirrors": ["https://96x8i0tt.mirror.aliyuncs.com"]
}
[root@localhost ~]# cat /etc/docker/daemon.json 
{
  "registry-mirrors": ["https://96x8i0tt.mirror.aliyuncs.com"]
}

2、重载Daemon配置文件并重启Docker服务:systemctl daemon-reload && systemctl restart docker.service

[root@localhost ~]# systemctl daemon-reload && systemctl restart docker.service

安装指定版本的Docker-CE(可选)

1、查找Docker-CE的版本:yum list docker-ce.x86_64 –showduplicates | sort -r

[root@localhost ~]# yum list docker-ce.x86_64 --showduplicates | sort -r
 * updates: mirrors.aliyun.com
Loading mirror speeds from cached hostfile
Loaded plugins: fastestmirror
Installed Packages
 * extras: mirrors.aliyun.com
docker-ce.x86_64            3:20.10.3-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.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 
 * base: mirrors.aliyun.com
Available Packages

2、安装指定版本的Docker-CE:yum -y install docker-ce-[VERSION]        #(VERSION例如列表中的19.03.9-3.el7)

[root@localhost ~]# yum -y install docker-ce-19.03.9-3.el7

IT运维网 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明CentOS 7 快速部署Docker-CE环境(阿里云版)
喜欢 (5)
yvan
关于作者:
聪明来自勤奋、知识在于积累、好记性不如烂键盘!

您必须 登录 才能发表评论!