RUI个人博客 首页>>Docker>>【原】CentOS7通过yum方式安装Docker

【原】CentOS7通过yum方式安装Docker

Get Docker CE for CentOS
Docker 分为开源免费的 CE(Community Edition)版本和收费的 EE(Enterprise Edition)版本。

官网链接:https://docs.docker.com/install/linux/docker-ce/centos/#os-requirements  通过官网学习会更佳(官网为英文)

当前实验环境的系统版本

[root@5ibig yum.repos.d]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core) 
1、卸载旧版本
Docker的较老的版本叫docker或者docker-engine,如果系统中已经安装了,那么卸载他们并且卸载相关的依赖
[root@5ibig yum.repos.d]# yum remove docker \
>                   docker-client \
>                   docker-client-latest \
>                   docker-common \
>                   docker-latest \
>                   docker-latest-logrotate \
>                   docker-logrotate \
>                   docker-selinux \
>                   docker-engine-selinux \
>                   docker-engine
Loaded plugins: fastestmirror, langpacks
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
No Match for argument: docker
No Match for argument: docker-client
No Match for argument: docker-client-latest
No Match for argument: docker-common
No Match for argument: docker-latest
No Match for argument: docker-latest-logrotate
No Match for argument: docker-logrotate
No Match for argument: docker-selinux
No Match for argument: docker-engine-selinux
No Match for argument: docker-engine
No Packages marked for removal
#很明显显示目前我的系统中没有安装相关的软件包

2、安装Docker CE
#本次环境是通过yum源的方式进行安装和升级,这也是官方推荐的方式

这里配置yum的方式不做介绍,不懂的可以参考我之前的博客:

http://www.5ibig.com/article/index/arcid/72.htm

[root@5ibig yum.repos.d]# cat CentOS-Base.repo
[Cenos7]
name = Centos7
baseurl=file:///iso/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[root@5ibig yum.repos.d]#
[root@5ibig yum.repos.d]#
[root@5ibig yum.repos.d]# ll /iso/
total 654
-rw-r--r-- 1 root root     14 Dec  5  2016 CentOS_BuildTag
drwxr-xr-x 3 root root   2048 Dec  5  2016 EFI
-rw-r--r-- 1 root root    215 Dec  9  2015 EULA
-rw-r--r-- 1 root root  18009 Dec  9  2015 GPL
drwxr-xr-x 3 root root   2048 Dec  5  2016 images
drwxr-xr-x 2 root root   2048 Dec  5  2016 isolinux
drwxr-xr-x 2 root root   2048 Dec  5  2016 LiveOS
drwxrwxr-x 2 root root 630784 Dec  5  2016 Packages
drwxrwxr-x 2 root root   4096 Dec  5  2016 repodata
-rw-r--r-- 1 root root   1690 Dec  9  2015 RPM-GPG-KEY-CentOS-7
-rw-r--r-- 1 root root   1690 Dec  9  2015 RPM-GPG-KEY-CentOS-Testing-7
-r--r--r-- 1 root root   2883 Dec  5  2016 TRANS.TBL
2.1、安装所需的软件包
[root@5ibig yum.repos.d]# yum install -y yum-utils \
> device-mapper-persistent-data  lvm2
Loaded plugins: fastestmirror, langpacks
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Cenos7                                                                            | 3.6 kB  00:00:00     
Not using downloaded repomd.xml because it is older than what we have:
  Current   : Wed Aug  9 13:48:17 2017
  Downloaded: Mon Dec  5 08:37:18 2016
base                                                                              | 3.6 kB  00:00:00     
extras                                                                            | 3.4 kB  00:00:00     
updates                                                                           | 3.4 kB  00:00:00     
(1/4): base/7/x86_64/group_gz                                                     | 166 kB  00:00:00     
(2/4): updates/7/x86_64/primary_db                                                | 4.2 MB  00:00:01     
(3/4): extras/7/x86_64/primary_db                                                 | 172 kB  00:00:01     
(4/4): base/7/x86_64/primary_db                                                   | 5.9 MB  00:00:04     
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package device-mapper-persistent-data.x86_64 0:0.6.3-1.el7 will be updated
---> Package device-mapper-persistent-data.x86_64 0:0.7.3-3.el7 will be an update
---> Package lvm2.x86_64 7:2.02.166-1.el7 will be updated
---> Package lvm2.x86_64 7:2.02.177-4.el7 will be an update
--> Processing Dependency: lvm2-libs = 7:2.02.177-4.el7 for package: 7:lvm2-2.02.177-4.el7.x86_64
--> Processing Dependency: libdevmapper.so.1.02(DM_1_02_141)(64bit) for package: 7:lvm2-2.02.177-4.el7.x86_64
--> Processing Dependency: libdevmapper.so.1.02(DM_1_02_138)(64bit) for package: 7:lvm2-2.02.177-4.el7.x86_64
---> Package yum-utils.noarch 0:1.1.31-40.el7 will be updated
---> Package yum-utils.noarch 0:1.1.31-45.el7 will be an update
--> Running transaction check
---> Package device-mapper-libs.x86_64 7:1.02.135-1.el7 will be updated
--> Processing Dependency: device-mapper-libs = 7:1.02.135-1.el7 for package: 7:device-mapper-1.02.135-1.el7.x86_64
---> Package device-mapper-libs.x86_64 7:1.02.146-4.el7 will be an update
---> Package lvm2-libs.x86_64 7:2.02.166-1.el7 will be updated
---> Package lvm2-libs.x86_64 7:2.02.177-4.el7 will be an update
--> Processing Dependency: device-mapper-event = 7:1.02.146-4.el7 for package: 7:lvm2-libs-2.02.177-4.el7.x86_64
--> Running transaction check
---> Package device-mapper.x86_64 7:1.02.135-1.el7 will be updated
---> Package device-mapper.x86_64 7:1.02.146-4.el7 will be an update
---> Package device-mapper-event.x86_64 7:1.02.135-1.el7 will be updated
---> Package device-mapper-event.x86_64 7:1.02.146-4.el7 will be an update
--> Processing Dependency: device-mapper-event-libs = 7:1.02.146-4.el7 for package: 7:device-mapper-event-1.02.146-4.el7.x86_64
--> Running transaction check
---> Package device-mapper-event-libs.x86_64 7:1.02.135-1.el7 will be updated
---> Package device-mapper-event-libs.x86_64 7:1.02.146-4.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================
 Package                                Arch            Version                      Repository     Size
=========================================================================================================
Updating:
 device-mapper-persistent-data          x86_64          0.7.3-3.el7                  base          405 k
 lvm2                                   x86_64          7:2.02.177-4.el7             base          1.3 M
 yum-utils                              noarch          1.1.31-45.el7                base          119 k
Updating for dependencies:
 device-mapper                          x86_64          7:1.02.146-4.el7             base          289 k
 device-mapper-event                    x86_64          7:1.02.146-4.el7             base          185 k
 device-mapper-event-libs               x86_64          7:1.02.146-4.el7             base          184 k
 device-mapper-libs                     x86_64          7:1.02.146-4.el7             base          316 k
 lvm2-libs                              x86_64          7:2.02.177-4.el7             base          1.0 M

Transaction Summary
=========================================================================================================
Upgrade  3 Packages (+5 Dependent packages)

Total download size: 3.8 M
Downloading packages:
No Presto metadata available for base
(1/8): device-mapper-event-1.02.146-4.el7.x86_64.rpm                              | 185 kB  00:00:00     
(2/8): device-mapper-1.02.146-4.el7.x86_64.rpm                                    | 289 kB  00:00:00     
(3/8): device-mapper-event-libs-1.02.146-4.el7.x86_64.rpm                         | 184 kB  00:00:00     
(4/8): device-mapper-persistent-data-0.7.3-3.el7.x86_64.rpm                       | 405 kB  00:00:00     
(5/8): device-mapper-libs-1.02.146-4.el7.x86_64.rpm                               | 316 kB  00:00:00     
(6/8): lvm2-2.02.177-4.el7.x86_64.rpm                                             | 1.3 MB  00:00:00     
(7/8): yum-utils-1.1.31-45.el7.noarch.rpm                                         | 119 kB  00:00:00     
(8/8): lvm2-libs-2.02.177-4.el7.x86_64.rpm                                        | 1.0 MB  00:00:00     
---------------------------------------------------------------------------------------------------------
Total                                                                    2.9 MB/s | 3.8 MB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : 7:device-mapper-libs-1.02.146-4.el7.x86_64                                           1/16
  Updating   : 7:device-mapper-1.02.146-4.el7.x86_64                                                2/16
  Updating   : 7:device-mapper-event-libs-1.02.146-4.el7.x86_64                                     3/16
  Updating   : 7:device-mapper-event-1.02.146-4.el7.x86_64                                          4/16
  Updating   : 7:lvm2-libs-2.02.177-4.el7.x86_64                                                    5/16
  Updating   : device-mapper-persistent-data-0.7.3-3.el7.x86_64                                     6/16
  Updating   : 7:lvm2-2.02.177-4.el7.x86_64                                                         7/16
  Updating   : yum-utils-1.1.31-45.el7.noarch                                                       8/16
  Cleanup    : yum-utils-1.1.31-40.el7.noarch                                                       9/16
  Cleanup    : 7:lvm2-2.02.166-1.el7.x86_64                                                        10/16
  Cleanup    : 7:lvm2-libs-2.02.166-1.el7.x86_64                                                   11/16
  Cleanup    : 7:device-mapper-event-1.02.135-1.el7.x86_64                                         12/16
  Cleanup    : 7:device-mapper-event-libs-1.02.135-1.el7.x86_64                                    13/16
  Cleanup    : 7:device-mapper-libs-1.02.135-1.el7.x86_64                                          14/16
  Cleanup    : 7:device-mapper-1.02.135-1.el7.x86_64                                               15/16
  Cleanup    : device-mapper-persistent-data-0.6.3-1.el7.x86_64                                    16/16
  Verifying  : device-mapper-persistent-data-0.7.3-3.el7.x86_64                                     1/16
  Verifying  : yum-utils-1.1.31-45.el7.noarch                                                       2/16
  Verifying  : 7:device-mapper-1.02.146-4.el7.x86_64                                                3/16
  Verifying  : 7:device-mapper-event-libs-1.02.146-4.el7.x86_64                                     4/16
  Verifying  : 7:device-mapper-event-1.02.146-4.el7.x86_64                                          5/16
  Verifying  : 7:lvm2-libs-2.02.177-4.el7.x86_64                                                    6/16
  Verifying  : 7:lvm2-2.02.177-4.el7.x86_64                                                         7/16
  Verifying  : 7:device-mapper-libs-1.02.146-4.el7.x86_64                                           8/16
  Verifying  : 7:device-mapper-event-libs-1.02.135-1.el7.x86_64                                     9/16
  Verifying  : 7:device-mapper-1.02.135-1.el7.x86_64                                               10/16
  Verifying  : 7:lvm2-2.02.166-1.el7.x86_64                                                        11/16
  Verifying  : yum-utils-1.1.31-40.el7.noarch                                                      12/16
  Verifying  : device-mapper-persistent-data-0.6.3-1.el7.x86_64                                    13/16
  Verifying  : 7:device-mapper-libs-1.02.135-1.el7.x86_64                                          14/16
  Verifying  : 7:device-mapper-event-1.02.135-1.el7.x86_64                                         15/16
  Verifying  : 7:lvm2-libs-2.02.166-1.el7.x86_64                                                   16/16

Updated:
  device-mapper-persistent-data.x86_64 0:0.7.3-3.el7             lvm2.x86_64 7:2.02.177-4.el7            
  yum-utils.noarch 0:1.1.31-45.el7                              

Dependency Updated:
  device-mapper.x86_64 7:1.02.146-4.el7                 device-mapper-event.x86_64 7:1.02.146-4.el7     
  device-mapper-event-libs.x86_64 7:1.02.146-4.el7      device-mapper-libs.x86_64 7:1.02.146-4.el7      
  lvm2-libs.x86_64 7:2.02.177-4.el7                    

Complete!
2.2、 通过以下命令来安装 stable 仓库
[root@5ibig yum.repos.d]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Loaded plugins: fastestmirror, langpacks
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
[root@5ibig yum.repos.d]# ls -rlt
total 20
-rw-r--r--  1 root root 2573 Nov 21  2014 Centos-7.repo
drwxr-xr-x. 2 root root  187 Jul 12  2017 bak
-rw-r--r--. 1 root root  118 Jul 12  2017 CentOS-Base.repo
-rw-r--r--  1 root root  155 Dec 18  2017 docker18.repo.bak
-rw-r--r--  1 root root  327 Dec 19  2017 ESCore-All.repo.bak
-rw-r--r--  1 root root 2424 Jul 20 15:12 docker-ce.repo
2.3、安装 DOCKER CE
#安装最新版本的Docker CE:
[root@5ibig yum.repos.d]# yum install docker-ce
Loaded plugins: fastestmirror, langpacks
docker-ce-edge                                                                    | 2.9 kB  00:00:00     
docker-ce-stable                                                                  | 2.9 kB  00:00:00     
docker-ce-test                                                                    | 2.9 kB  00:00:00     
(1/3): docker-ce-stable/x86_64/primary_db                                         |  14 kB  00:00:02     
(2/3): docker-ce-edge/x86_64/primary_db                                           |  18 kB  00:00:02     
(3/3): docker-ce-test/x86_64/primary_db                                           |  49 kB  00:00:03     
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 0:18.06.0.ce-3.el7 will be installed
--> Processing Dependency: container-selinux >= 2.9 for package: docker-ce-18.06.0.ce-3.el7.x86_64
--> Running transaction check
---> Package container-selinux.noarch 2:2.66-1.el7 will be installed
--> Processing Dependency: selinux-policy-targeted >= 3.13.1-192 for package: 2:container-selinux-2.66-1.el7.noarch
--> Processing Dependency: selinux-policy-base >= 3.13.1-192 for package: 2:container-selinux-2.66-1.el7.noarch
--> Processing Dependency: selinux-policy >= 3.13.1-192 for package: 2:container-selinux-2.66-1.el7.noarch
--> Processing Dependency: policycoreutils >= 2.5-11 for package: 2:container-selinux-2.66-1.el7.noarch
--> Running transaction check
---> Package policycoreutils.x86_64 0:2.5-8.el7 will be updated
--> Processing Dependency: policycoreutils = 2.5-8.el7 for package: policycoreutils-python-2.5-8.el7.x86_64
---> Package policycoreutils.x86_64 0:2.5-22.el7 will be an update
--> Processing Dependency: libsepol >= 2.5-8 for package: policycoreutils-2.5-22.el7.x86_64
--> Processing Dependency: libselinux-utils >= 2.5-12 for package: policycoreutils-2.5-22.el7.x86_64
---> Package selinux-policy.noarch 0:3.13.1-102.el7 will be updated
---> Package selinux-policy.noarch 0:3.13.1-192.el7_5.4 will be an update
---> Package selinux-policy-targeted.noarch 0:3.13.1-102.el7 will be updated
---> Package selinux-policy-targeted.noarch 0:3.13.1-192.el7_5.4 will be an update
--> Running transaction check
---> Package libselinux-utils.x86_64 0:2.5-6.el7 will be updated
---> Package libselinux-utils.x86_64 0:2.5-12.el7 will be an update
--> Processing Dependency: libselinux(x86-64) = 2.5-12.el7 for package: libselinux-utils-2.5-12.el7.x86_64
---> Package libsepol.x86_64 0:2.5-6.el7 will be updated
---> Package libsepol.x86_64 0:2.5-8.1.el7 will be an update
---> Package policycoreutils-python.x86_64 0:2.5-8.el7 will be updated
---> Package policycoreutils-python.x86_64 0:2.5-22.el7 will be an update
--> Processing Dependency: setools-libs >= 3.3.8-2 for package: policycoreutils-python-2.5-22.el7.x86_64
--> Processing Dependency: libsemanage-python >= 2.5-9 for package: policycoreutils-python-2.5-22.el7.x86_64
--> Running transaction check
---> Package libselinux.x86_64 0:2.5-6.el7 will be updated
--> Processing Dependency: libselinux(x86-64) = 2.5-6.el7 for package: libselinux-python-2.5-6.el7.x86_64
---> Package libselinux.x86_64 0:2.5-12.el7 will be an update
---> Package libsemanage-python.x86_64 0:2.5-4.el7 will be updated
---> Package libsemanage-python.x86_64 0:2.5-11.el7 will be an update
--> Processing Dependency: libsemanage = 2.5-11.el7 for package: libsemanage-python-2.5-11.el7.x86_64
---> Package setools-libs.x86_64 0:3.3.8-1.1.el7 will be updated
---> Package setools-libs.x86_64 0:3.3.8-2.el7 will be an update
--> Running transaction check
---> Package libselinux-python.x86_64 0:2.5-6.el7 will be updated
---> Package libselinux-python.x86_64 0:2.5-12.el7 will be an update
---> Package libsemanage.x86_64 0:2.5-4.el7 will be updated
---> Package libsemanage.x86_64 0:2.5-11.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================
 Package                         Arch           Version                     Repository              Size
=========================================================================================================
Installing:
 docker-ce                       x86_64         18.06.0.ce-3.el7            docker-ce-edge          41 M
Installing for dependencies:
 container-selinux               noarch         2:2.66-1.el7                extras                  35 k
Updating for dependencies:
 libselinux                      x86_64         2.5-12.el7                  base                   162 k
 libselinux-python               x86_64         2.5-12.el7                  base                   235 k
 libselinux-utils                x86_64         2.5-12.el7                  base                   151 k
 libsemanage                     x86_64         2.5-11.el7                  base                   150 k
 libsemanage-python              x86_64         2.5-11.el7                  base                   112 k
 libsepol                        x86_64         2.5-8.1.el7                 base                   297 k
 policycoreutils                 x86_64         2.5-22.el7                  base                   867 k
 policycoreutils-python          x86_64         2.5-22.el7                  base                   454 k
 selinux-policy                  noarch         3.13.1-192.el7_5.4          updates                453 k
 selinux-policy-targeted         noarch         3.13.1-192.el7_5.4          updates                6.6 M
 setools-libs                    x86_64         3.3.8-2.el7                 base                   619 k

Transaction Summary
=========================================================================================================
Install  1 Package  (+ 1 Dependent package)
Upgrade             ( 11 Dependent packages)

Total download size: 51 M
Is this ok [y/d/N]: y
Downloading packages:
No Presto metadata available for base
updates/7/x86_64/prestodelta                                                      | 383 kB  00:00:00     
(1/13): container-selinux-2.66-1.el7.noarch.rpm                                   |  35 kB  00:00:00     
(2/13): libselinux-2.5-12.el7.x86_64.rpm                                          | 162 kB  00:00:01     
(3/13): libselinux-python-2.5-12.el7.x86_64.rpm                                   | 235 kB  00:00:01     
(4/13): libsemanage-2.5-11.el7.x86_64.rpm                                         | 150 kB  00:00:00     
(5/13): libsemanage-python-2.5-11.el7.x86_64.rpm                                  | 112 kB  00:00:00     
(6/13): libselinux-utils-2.5-12.el7.x86_64.rpm                                    | 151 kB  00:00:00     
(7/13): libsepol-2.5-8.1.el7.x86_64.rpm                                           | 297 kB  00:00:00     
(8/13): policycoreutils-2.5-22.el7.x86_64.rpm                                     | 867 kB  00:00:00     
(9/13): setools-libs-3.3.8-2.el7.x86_64.rpm                                       | 619 kB  00:00:00     
(10/13): policycoreutils-python-2.5-22.el7.x86_64.rpm                             | 454 kB  00:00:00     
(11/13): selinux-policy-3.13.1-192.el7_5.4.noarch.rpm                             | 453 kB  00:00:00     
(12/13): selinux-policy-targeted-3.13.1-192.el7_5.4.noarch.rpm                    | 6.6 MB  00:00:01     
warning: /var/cache/yum/x86_64/7/docker-ce-edge/packages/docker-ce-18.06.0.ce-3.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
Public key for docker-ce-18.06.0.ce-3.el7.x86_64.rpm is not installed
(13/13): docker-ce-18.06.0.ce-3.el7.x86_64.rpm                                    |  41 MB  00:05:03     
---------------------------------------------------------------------------------------------------------
Total                                                                    171 kB/s |  51 MB  00:05:03     
Retrieving key from https://download.docker.com/linux/centos/gpg
Importing GPG key 0x621E9F35:
 Userid     : "Docker Release (CE rpm) "
 Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
 From       : https://download.docker.com/linux/centos/gpg
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : libsepol-2.5-8.1.el7.x86_64                                                          1/24
  Updating   : libselinux-2.5-12.el7.x86_64                                                         2/24
  Updating   : libsemanage-2.5-11.el7.x86_64                                                        3/24
  Updating   : libselinux-utils-2.5-12.el7.x86_64                                                   4/24
  Updating   : policycoreutils-2.5-22.el7.x86_64                                                    5/24
  Updating   : selinux-policy-3.13.1-192.el7_5.4.noarch                                             6/24
  Updating   : selinux-policy-targeted-3.13.1-192.el7_5.4.noarch                                    7/24
  Updating   : libsemanage-python-2.5-11.el7.x86_64                                                 8/24
  Updating   : libselinux-python-2.5-12.el7.x86_64                                                  9/24
  Updating   : setools-libs-3.3.8-2.el7.x86_64                                                     10/24
  Updating   : policycoreutils-python-2.5-22.el7.x86_64                                            11/24
  Installing : 2:container-selinux-2.66-1.el7.noarch                                               12/24
setsebool:  SELinux is disabled.
  Installing : docker-ce-18.06.0.ce-3.el7.x86_64                                                   13/24
  Cleanup    : selinux-policy-targeted-3.13.1-102.el7.noarch                                       14/24
  Cleanup    : policycoreutils-python-2.5-8.el7.x86_64                                             15/24
  Cleanup    : selinux-policy-3.13.1-102.el7.noarch                                                16/24
  Cleanup    : policycoreutils-2.5-8.el7.x86_64                                                    17/24
  Cleanup    : libselinux-utils-2.5-6.el7.x86_64                                                   18/24
  Cleanup    : setools-libs-3.3.8-1.1.el7.x86_64                                                   19/24
  Cleanup    : libselinux-python-2.5-6.el7.x86_64                                                  20/24
  Cleanup    : libsemanage-python-2.5-4.el7.x86_64                                                 21/24
  Cleanup    : libsemanage-2.5-4.el7.x86_64                                                        22/24
  Cleanup    : libselinux-2.5-6.el7.x86_64                                                         23/24
  Cleanup    : libsepol-2.5-6.el7.x86_64                                                           24/24
  Verifying  : libsemanage-python-2.5-11.el7.x86_64                                                 1/24
  Verifying  : libsemanage-2.5-11.el7.x86_64                                                        2/24
  Verifying  : libselinux-python-2.5-12.el7.x86_64                                                  3/24
  Verifying  : selinux-policy-3.13.1-192.el7_5.4.noarch                                             4/24
  Verifying  : setools-libs-3.3.8-2.el7.x86_64                                                      5/24
  Verifying  : policycoreutils-2.5-22.el7.x86_64                                                    6/24
  Verifying  : selinux-policy-targeted-3.13.1-192.el7_5.4.noarch                                    7/24
  Verifying  : policycoreutils-python-2.5-22.el7.x86_64                                             8/24
  Verifying  : 2:container-selinux-2.66-1.el7.noarch                                                9/24
  Verifying  : docker-ce-18.06.0.ce-3.el7.x86_64                                                   10/24
  Verifying  : libsepol-2.5-8.1.el7.x86_64                                                         11/24
  Verifying  : libselinux-2.5-12.el7.x86_64                                                        12/24
  Verifying  : libselinux-utils-2.5-12.el7.x86_64                                                  13/24
  Verifying  : policycoreutils-2.5-8.el7.x86_64                                                    14/24
  Verifying  : libsepol-2.5-6.el7.x86_64                                                           15/24
  Verifying  : libselinux-python-2.5-6.el7.x86_64                                                  16/24
  Verifying  : libselinux-utils-2.5-6.el7.x86_64                                                   17/24
  Verifying  : libsemanage-python-2.5-4.el7.x86_64                                                 18/24
  Verifying  : policycoreutils-python-2.5-8.el7.x86_64                                             19/24
  Verifying  : selinux-policy-3.13.1-102.el7.noarch                                                20/24
  Verifying  : libselinux-2.5-6.el7.x86_64                                                         21/24
  Verifying  : selinux-policy-targeted-3.13.1-102.el7.noarch                                       22/24
  Verifying  : libsemanage-2.5-4.el7.x86_64                                                        23/24
  Verifying  : setools-libs-3.3.8-1.1.el7.x86_64                                                   24/24

Installed:
  docker-ce.x86_64 0:18.06.0.ce-3.el7                                                                    

Dependency Installed:
  container-selinux.noarch 2:2.66-1.el7                                                                  

Dependency Updated:
  libselinux.x86_64 0:2.5-12.el7                 libselinux-python.x86_64 0:2.5-12.el7                  
  libselinux-utils.x86_64 0:2.5-12.el7           libsemanage.x86_64 0:2.5-11.el7                        
  libsemanage-python.x86_64 0:2.5-11.el7         libsepol.x86_64 0:2.5-8.1.el7                          
  policycoreutils.x86_64 0:2.5-22.el7            policycoreutils-python.x86_64 0:2.5-22.el7             
  selinux-policy.noarch 0:3.13.1-192.el7_5.4     selinux-policy-targeted.noarch 0:3.13.1-192.el7_5.4    
  setools-libs.x86_64 0:3.3.8-2.el7             

Complete!
[root@5ibig yum.repos.d]# 
3、开启Docker环境并且测试:
[root@5ibig yum.repos.d]# systemctl start docker
[root@5ibig yum.repos.d]#
[root@5ibig yum.repos.d]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: active (running) since Sat 2018-07-21 04:52:06 EDT; 5s ago
     Docs: https://docs.docker.com
 Main PID: 1977 (dockerd)
   Memory: 47.5M
   CGroup: /system.slice/docker.service
           ├─1977 /usr/bin/dockerd
           └─1983 docker-containerd --config /var/run/docker/containerd/containerd.toml

Jul 21 04:52:05 5ibig dockerd[1977]: time="2018-07-21T04:52:05.546984124-04:00" level=info msg="Cl...grpc
Jul 21 04:52:05 5ibig dockerd[1977]: time="2018-07-21T04:52:05.547107929-04:00" level=info msg="pi...grpc
Jul 21 04:52:05 5ibig dockerd[1977]: time="2018-07-21T04:52:05.547385769-04:00" level=info msg="pi...grpc
Jul 21 04:52:05 5ibig dockerd[1977]: time="2018-07-21T04:52:05.547425666-04:00" level=info msg="Lo...rt."
Jul 21 04:52:06 5ibig dockerd[1977]: time="2018-07-21T04:52:06.776872533-04:00" level=info msg="De...ess"
Jul 21 04:52:06 5ibig dockerd[1977]: time="2018-07-21T04:52:06.860513814-04:00" level=info msg="Lo...ne."
Jul 21 04:52:06 5ibig dockerd[1977]: time="2018-07-21T04:52:06.866833041-04:00" level=info msg="Do...0-ce
Jul 21 04:52:06 5ibig dockerd[1977]: time="2018-07-21T04:52:06.866914216-04:00" level=info msg="Da...ion"
Jul 21 04:52:06 5ibig dockerd[1977]: time="2018-07-21T04:52:06.964001679-04:00" level=info msg="AP...ock"
Jul 21 04:52:06 5ibig systemd[1]: Started Docker Application Container Engine.
Hint: Some lines were ellipsized, use -l to show in full.
[root@5ibig yum.repos.d]#
[root@5ibig yum.repos.d]#
[root@5ibig yum.repos.d]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
9db2ca6ccae0: Pull complete
Digest: sha256:4b8ff392a12ed9ea17784bd3c9a8b1fa3299cac44aca35a85c90c5e3c7afacdc
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/engine/userguide/
#运行httpd的容器,更加加深印象
[root@5ibig yum.repos.d]# docker run -d -p 80:80 httpd
Unable to find image 'httpd:latest' locally
latest: Pulling from library/httpd
d660b1f15b9b: Pull complete
aa1c79a2fa37: Pull complete
f5f6514c0aff: Pull complete
676d3dd26040: Pull complete
4fdddf845a1b: Pull complete
28ecdadc5f88: Pull complete
5d882098e42b: Pull complete
Digest: sha256:d51fc59047fb061cb862c703d32288ac3d86e6966d90c03d822c36ca0ac2b565
Status: Downloaded newer image for httpd:latest
a7748f501171bb6342774775c225da54c911e1f94da4b896866785fcb2d571f1
[root@5ibig yum.repos.d]#
[root@5ibig yum.repos.d]#
[root@5ibig yum.repos.d]# docker ps
CONTAINER ID        IMAGE               COMMAND              CREATED              STATUS              PORTS                NAMES
a7748f501171        httpd               "httpd-foreground"   About a minute ago   Up About a minute   0.0.0.0:80->80/tcp   unruffled_perlman

##可以通过配置daocloud的加速器(免费的)
https://www.daocloud.io/mirror#accelerator-doc

curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://1fef3352.m.daocloud.io

2018.7.21 于 北京广安康馨家传   tyger.wang
昵  称:
邮  箱:
评论内容:
验 证 码:
可用[code][/code]插入代码
点击刷新验证码