docker安装

1、系统环境

Docker 要求 CentOS 系统的内核版本高于 3.10 ,查看本页面的前提条件来验证你的CentOS 版本是否支持 Docker 。

通过 uname -r 命令查看你当前的内核版本

1 [root@localhost ~]# uname -a
2 Linux localhost.localdomain 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux


2、安装 Docker

Docker 软件包和依赖包已经包含在默认的 CentOS-Extras 软件源里,安装命令如下:

  1 [root@localhost ~]# yum -y install docker
  2 已加载插件:fastestmirror, langpacks
  3 Loading mirror speeds from cached hostfile
  4  * base: mirrors.yun-idc.com
  5  * extras: mirrors.aliyun.com
  6  * updates: mirrors.btte.net
  7 正在解决依赖关系
  8 --> 正在检查事务
  9 ---> 软件包 docker.x86_64.2.1.12.6-32.git88a4867.el7.centos 将被 安装
 10 --> 正在处理依赖关系 docker-common = 2:1.12.6-32.git88a4867.el7.centos,它被软件包 2:docker-1.12.6-32.git88a4867.el7.centos.x86_64 需要
 11 --> 正在处理依赖关系 docker-client = 2:1.12.6-32.git88a4867.el7.centos,它被软件包 2:docker-1.12.6-32.git88a4867.el7.centos.x86_64 需要
 12 --> 正在处理依赖关系 oci-systemd-hook >= 1:0.1.4-9,它被软件包 2:docker-1.12.6-32.git88a4867.el7.centos.x86_64 需要
 13 --> 正在处理依赖关系 oci-register-machine >= 1:0-3.10,它被软件包 2:docker-1.12.6-32.git88a4867.el7.centos.x86_64 需要
 14 --> 正在处理依赖关系 device-mapper-libs >= 7:1.02.97,它被软件包 2:docker-1.12.6-32.git88a4867.el7.centos.x86_64 需要
 15 --> 正在处理依赖关系 container-selinux >= 2:2.12-2,它被软件包 2:docker-1.12.6-32.git88a4867.el7.centos.x86_64 需要
 16 --> 正在处理依赖关系 skopeo-containers,它被软件包 2:docker-1.12.6-32.git88a4867.el7.centos.x86_64 需要
 17 --> 正在处理依赖关系 libsystemd.so.0(LIBSYSTEMD_209)(64bit),它被软件包 2:docker-1.12.6-32.git88a4867.el7.centos.x86_64 需要
 18 --> 正在处理依赖关系 libdevmapper.so.1.02(DM_1_02_97)(64bit),它被软件包 2:docker-1.12.6-32.git88a4867.el7.centos.x86_64 需要
 19 --> 正在处理依赖关系 libsystemd.so.0()(64bit),它被软件包 2:docker-1.12.6-32.git88a4867.el7.centos.x86_64 需要
 20 --> 正在检查事务
 21 ---> 软件包 container-selinux.noarch.2.2.19-2.1.el7 将被 安装
 22 --> 正在处理依赖关系 selinux-policy-targeted >= 3.13.1-39,它被软件包 2:container-selinux-2.19-2.1.el7.noarch 需要
 23 --> 正在处理依赖关系 selinux-policy-base >= 3.13.1-39,它被软件包 2:container-selinux-2.19-2.1.el7.noarch 需要
 24 --> 正在处理依赖关系 selinux-policy >= 3.13.1-39,它被软件包 2:container-selinux-2.19-2.1.el7.noarch 需要
 25 --> 正在处理依赖关系 policycoreutils >= 2.5-11,它被软件包 2:container-selinux-2.19-2.1.el7.noarch 需要
 26 ---> 软件包 device-mapper-libs.x86_64.7.1.02.93-3.el7 将被 升级
 27 --> 正在处理依赖关系 device-mapper-libs = 7:1.02.93-3.el7,它被软件包 7:device-mapper-1.02.93-3.el7.x86_64 需要
 28 ---> 软件包 device-mapper-libs.x86_64.7.1.02.135-1.el7_3.5 将被 更新
 29 ---> 软件包 docker-client.x86_64.2.1.12.6-32.git88a4867.el7.centos 将被 安装
 30 ---> 软件包 docker-common.x86_64.2.1.12.6-32.git88a4867.el7.centos 将被 安装
 31 ---> 软件包 oci-register-machine.x86_64.1.0-3.11.gitdd0daef.el7 将被 安装
 32 ---> 软件包 oci-systemd-hook.x86_64.1.0.1.7-4.gite533efa.el7 将被 安装
 33 ---> 软件包 skopeo-containers.x86_64.1.0.1.20-2.el7 将被 安装
 34 ---> 软件包 systemd-libs.x86_64.0.208-20.el7 将被 升级
 35 --> 正在处理依赖关系 systemd-libs = 208-20.el7,它被软件包 systemd-208-20.el7.x86_64 需要
 36 ---> 软件包 systemd-libs.x86_64.0.219-30.el7_3.9 将被 更新
 37 --> 正在检查事务
 38 ---> 软件包 device-mapper.x86_64.7.1.02.93-3.el7 将被 升级
 39 --> 正在处理依赖关系 device-mapper = 7:1.02.93-3.el7,它被软件包 7:device-mapper-event-1.02.93-3.el7.x86_64 需要
 40 ---> 软件包 device-mapper.x86_64.7.1.02.135-1.el7_3.5 将被 更新
 41 ---> 软件包 policycoreutils.x86_64.0.2.2.5-15.el7 将被 升级
 42 --> 正在处理依赖关系 policycoreutils = 2.2.5-15.el7,它被软件包 policycoreutils-python-2.2.5-15.el7.x86_64 需要
 43 ---> 软件包 policycoreutils.x86_64.0.2.5-11.el7_3 将被 更新
 44 --> 正在处理依赖关系 libsepol >= 2.5-6,它被软件包 policycoreutils-2.5-11.el7_3.x86_64 需要
 45 --> 正在处理依赖关系 libselinux-utils >= 2.5-6,它被软件包 policycoreutils-2.5-11.el7_3.x86_64 需要
 46 --> 正在处理依赖关系 libsepol.so.1(LIBSEPOL_1.1)(64bit),它被软件包 policycoreutils-2.5-11.el7_3.x86_64 需要
 47 --> 正在处理依赖关系 libsepol.so.1(LIBSEPOL_1.0)(64bit),它被软件包 policycoreutils-2.5-11.el7_3.x86_64 需要
 48 --> 正在处理依赖关系 libsemanage.so.1(LIBSEMANAGE_1.1)(64bit),它被软件包 policycoreutils-2.5-11.el7_3.x86_64 需要
 49 ---> 软件包 selinux-policy.noarch.0.3.13.1-23.el7 将被 升级
 50 ---> 软件包 selinux-policy.noarch.0.3.13.1-102.el7_3.16 将被 更新
 51 ---> 软件包 selinux-policy-targeted.noarch.0.3.13.1-23.el7 将被 升级
 52 ---> 软件包 selinux-policy-targeted.noarch.0.3.13.1-102.el7_3.16 将被 更新
 53 ---> 软件包 systemd.x86_64.0.208-20.el7 将被 升级
 54 --> 正在处理依赖关系 systemd = 208-20.el7,它被软件包 systemd-python-208-20.el7.x86_64 需要
 55 --> 正在处理依赖关系 systemd = 208-20.el7,它被软件包 systemd-sysv-208-20.el7.x86_64 需要
 56 --> 正在处理依赖关系 systemd = 208-20.el7,它被软件包 libgudev1-208-20.el7.x86_64 需要
 57 ---> 软件包 systemd.x86_64.0.219-30.el7_3.9 将被 更新
 58 --> 正在处理依赖关系 kmod >= 18-4,它被软件包 systemd-219-30.el7_3.9.x86_64 需要
 59 --> 正在检查事务
 60 ---> 软件包 device-mapper-event.x86_64.7.1.02.93-3.el7 将被 升级
 61 --> 正在处理依赖关系 device-mapper-event = 7:1.02.93-3.el7,它被软件包 7:lvm2-libs-2.02.115-3.el7.x86_64 需要
 62 ---> 软件包 device-mapper-event.x86_64.7.1.02.135-1.el7_3.5 将被 更新
 63 --> 正在处理依赖关系 device-mapper-event-libs = 7:1.02.135-1.el7_3.5,它被软件包 7:device-mapper-event-1.02.135-1.el7_3.5.x86_64 需要
 64 ---> 软件包 kmod.x86_64.0.14-10.el7 将被 升级
 65 ---> 软件包 kmod.x86_64.0.20-9.el7 将被 更新
 66 ---> 软件包 libgudev1.x86_64.0.208-20.el7 将被 升级
 67 ---> 软件包 libgudev1.x86_64.0.219-30.el7_3.9 将被 更新
 68 --> 正在处理依赖关系 glib2 >= 2.42,它被软件包 libgudev1-219-30.el7_3.9.x86_64 需要
 69 ---> 软件包 libselinux-utils.x86_64.0.2.2.2-6.el7 将被 升级
 70 ---> 软件包 libselinux-utils.x86_64.0.2.5-6.el7 将被 更新
 71 --> 正在处理依赖关系 libselinux(x86-64) = 2.5-6.el7,它被软件包 libselinux-utils-2.5-6.el7.x86_64 需要
 72 ---> 软件包 libsemanage.x86_64.0.2.1.10-16.el7 将被 升级
 73 --> 正在处理依赖关系 libsemanage = 2.1.10-16.el7,它被软件包 libsemanage-python-2.1.10-16.el7.x86_64 需要
 74 ---> 软件包 libsemanage.x86_64.0.2.5-5.1.el7_3 将被 更新
 75 ---> 软件包 libsepol.x86_64.0.2.1.9-3.el7 将被 升级
 76 ---> 软件包 libsepol.x86_64.0.2.5-6.el7 将被 更新
 77 ---> 软件包 policycoreutils-python.x86_64.0.2.2.5-15.el7 将被 升级
 78 ---> 软件包 policycoreutils-python.x86_64.0.2.5-11.el7_3 将被 更新
 79 --> 正在处理依赖关系 setools-libs >= 3.3.8-1,它被软件包 policycoreutils-python-2.5-11.el7_3.x86_64 需要
 80 ---> 软件包 systemd-python.x86_64.0.208-20.el7 将被 升级
 81 ---> 软件包 systemd-python.x86_64.0.219-30.el7_3.9 将被 更新
 82 ---> 软件包 systemd-sysv.x86_64.0.208-20.el7 将被 升级
 83 ---> 软件包 systemd-sysv.x86_64.0.219-30.el7_3.9 将被 更新
 84 --> 正在检查事务
 85 ---> 软件包 device-mapper-event-libs.x86_64.7.1.02.93-3.el7 将被 升级
 86 ---> 软件包 device-mapper-event-libs.x86_64.7.1.02.135-1.el7_3.5 将被 更新
 87 ---> 软件包 glib2.x86_64.0.2.40.0-4.el7 将被 升级
 88 ---> 软件包 glib2.x86_64.0.2.46.2-4.el7 将被 更新
 89 ---> 软件包 libselinux.x86_64.0.2.2.2-6.el7 将被 升级
 90 --> 正在处理依赖关系 libselinux = 2.2.2-6.el7,它被软件包 libselinux-python-2.2.2-6.el7.x86_64 需要
 91 ---> 软件包 libselinux.x86_64.0.2.5-6.el7 将被 更新
 92 ---> 软件包 libsemanage-python.x86_64.0.2.1.10-16.el7 将被 升级
 93 ---> 软件包 libsemanage-python.x86_64.0.2.5-5.1.el7_3 将被 更新
 94 ---> 软件包 lvm2-libs.x86_64.7.2.02.115-3.el7 将被 升级
 95 --> 正在处理依赖关系 lvm2-libs = 7:2.02.115-3.el7,它被软件包 7:lvm2-2.02.115-3.el7.x86_64 需要
 96 --> 正在处理依赖关系 lvm2-libs = 7:2.02.115-3.el7,它被软件包 7:lvm2-python-libs-2.02.115-3.el7.x86_64 需要
 97 ---> 软件包 lvm2-libs.x86_64.7.2.02.166-1.el7_3.5 将被 更新
 98 ---> 软件包 setools-libs.x86_64.0.3.3.7-46.el7 将被 升级
 99 ---> 软件包 setools-libs.x86_64.0.3.3.8-1.1.el7 将被 更新
100 --> 正在检查事务
101 ---> 软件包 libselinux-python.x86_64.0.2.2.2-6.el7 将被 升级
102 ---> 软件包 libselinux-python.x86_64.0.2.5-6.el7 将被 更新
103 ---> 软件包 lvm2.x86_64.7.2.02.115-3.el7 将被 升级
104 ---> 软件包 lvm2.x86_64.7.2.02.166-1.el7_3.5 将被 更新
105 --> 正在处理依赖关系 device-mapper-persistent-data >= 0.6.3-1,它被软件包 7:lvm2-2.02.166-1.el7_3.5.x86_64 需要
106 ---> 软件包 lvm2-python-libs.x86_64.7.2.02.115-3.el7 将被 升级
107 ---> 软件包 lvm2-python-libs.x86_64.7.2.02.166-1.el7_3.5 将被 更新
108 --> 正在检查事务
109 ---> 软件包 device-mapper-persistent-data.x86_64.0.0.4.1-2.el7 将被 升级
110 ---> 软件包 device-mapper-persistent-data.x86_64.0.0.6.3-1.el7 将被 更新
111 --> 处理 systemd-219-30.el7_3.9.x86_64 与 initscripts < 9.49.28-1 的冲突
112 --> 正在使用新的信息重新解决依赖关系
113 --> 正在检查事务
114 ---> 软件包 initscripts.x86_64.0.9.49.24-1.el7 将被 升级
115 ---> 软件包 initscripts.x86_64.0.9.49.37-1.el7_3.1 将被 更新
116 --> 处理 systemd-219-30.el7_3.9.x86_64 与 dracut < 033-243 的冲突
117 --> 正在使用新的信息重新解决依赖关系
118 --> 正在检查事务
119 ---> 软件包 dracut.x86_64.0.033-240.el7 将被 升级
120 --> 正在处理依赖关系 dracut = 033-240.el7,它被软件包 dracut-config-rescue-033-240.el7.x86_64 需要
121 --> 正在处理依赖关系 dracut = 033-240.el7,它被软件包 dracut-network-033-240.el7.x86_64 需要
122 ---> 软件包 dracut.x86_64.0.033-463.el7_3.2 将被 更新
123 --> 正在检查事务
124 ---> 软件包 dracut-config-rescue.x86_64.0.033-240.el7 将被 升级
125 ---> 软件包 dracut-config-rescue.x86_64.0.033-463.el7_3.2 将被 更新
126 ---> 软件包 dracut-network.x86_64.0.033-240.el7 将被 升级
127 ---> 软件包 dracut-network.x86_64.0.033-463.el7_3.2 将被 更新
128 --> 解决依赖关系完成
129 
130 依赖关系解决
131 
132 ========================================================================================================================================================================
133  Package                                           架构                       版本                                                    源                           大小
134 ========================================================================================================================================================================
135 正在安装:
136  docker                                            x86_64                     2:1.12.6-32.git88a4867.el7.centos                       extras                       14 M
137 正在更新:
138  dracut                                            x86_64                     033-463.el7_3.2                                         updates                     318 k
139  initscripts                                       x86_64                     9.49.37-1.el7_3.1                                       updates                     432 k
140 为依赖而安装:
141  container-selinux                                 noarch                     2:2.19-2.1.el7                                          extras                       28 k
142  docker-client                                     x86_64                     2:1.12.6-32.git88a4867.el7.centos                       extras                      3.2 M
143  docker-common                                     x86_64                     2:1.12.6-32.git88a4867.el7.centos                       extras                       77 k
144  oci-register-machine                              x86_64                     1:0-3.11.gitdd0daef.el7                                 extras                      1.0 M
145  oci-systemd-hook                                  x86_64                     1:0.1.7-4.gite533efa.el7                                extras                       30 k
146  skopeo-containers                                 x86_64                     1:0.1.20-2.el7                                          extras                      7.8 k
147 为依赖而更新:
148  device-mapper                                     x86_64                     7:1.02.135-1.el7_3.5                                    updates                     269 k
149  device-mapper-event                               x86_64                     7:1.02.135-1.el7_3.5                                    updates                     178 k
150  device-mapper-event-libs                          x86_64                     7:1.02.135-1.el7_3.5                                    updates                     177 k
151  device-mapper-libs                                x86_64                     7:1.02.135-1.el7_3.5                                    updates                     333 k
152  device-mapper-persistent-data                     x86_64                     0.6.3-1.el7                                             base                        368 k
153  dracut-config-rescue                              x86_64                     033-463.el7_3.2                                         updates                      54 k
154  dracut-network                                    x86_64                     033-463.el7_3.2                                         updates                      96 k
155  glib2                                             x86_64                     2.46.2-4.el7                                            base                        2.3 M
156  kmod                                              x86_64                     20-9.el7                                                base                        115 k
157  libgudev1                                         x86_64                     219-30.el7_3.9                                          updates                      77 k
158  libselinux                                        x86_64                     2.5-6.el7                                               base                        161 k
159  libselinux-python                                 x86_64                     2.5-6.el7                                               base                        234 k
160  libselinux-utils                                  x86_64                     2.5-6.el7                                               base                        151 k
161  libsemanage                                       x86_64                     2.5-5.1.el7_3                                           updates                     144 k
162  libsemanage-python                                x86_64                     2.5-5.1.el7_3                                           updates                     104 k
163  libsepol                                          x86_64                     2.5-6.el7                                               base                        288 k
164  lvm2                                              x86_64                     7:2.02.166-1.el7_3.5                                    updates                     1.1 M
165  lvm2-libs                                         x86_64                     7:2.02.166-1.el7_3.5                                    updates                     987 k
166  lvm2-python-libs                                  x86_64                     7:2.02.166-1.el7_3.5                                    updates                     174 k
167  policycoreutils                                   x86_64                     2.5-11.el7_3                                            updates                     841 k
168  policycoreutils-python                            x86_64                     2.5-11.el7_3                                            updates                     445 k
169  selinux-policy                                    noarch                     3.13.1-102.el7_3.16                                     updates                     414 k
170  selinux-policy-targeted                           noarch                     3.13.1-102.el7_3.16                                     updates                     6.4 M
171  setools-libs                                      x86_64                     3.3.8-1.1.el7                                           base                        612 k
172  systemd                                           x86_64                     219-30.el7_3.9                                          updates                     5.2 M
173  systemd-libs                                      x86_64                     219-30.el7_3.9                                          updates                     369 k
174  systemd-python                                    x86_64                     219-30.el7_3.9                                          updates                     110 k
175  systemd-sysv                                      x86_64                     219-30.el7_3.9                                          updates                      64 k
176 
177 事务概要
178 ========================================================================================================================================================================
179 安装  1 软件包 (+ 6 依赖软件包)
180 升级  2 软件包 (+28 依赖软件包)
181 
182 总计:41 M
183 总下载量:19 M
184 Downloading packages:
185 警告:/var/cache/yum/x86_64/7/extras/packages/container-selinux-2.19-2.1.el7.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY0 B/s |    0 B  --:--:-- ETA 
186 container-selinux-2.19-2.1.el7.noarch.rpm 的公钥尚未安装
187 (1/7): container-selinux-2.19-2.1.el7.noarch.rpm                                                                                                 |  28 kB  00:00:00     
188 (2/7): docker-common-1.12.6-32.git88a4867.el7.centos.x86_64.rpm                                                                                  |  77 kB  00:00:01     
189 (3/7): oci-register-machine-0-3.11.gitdd0daef.el7.x86_64.rpm                                                                                     | 1.0 MB  00:00:02     
190 (4/7): oci-systemd-hook-0.1.7-4.gite533efa.el7.x86_64.rpm                                                                                        |  30 kB  00:00:00     
191 (5/7): skopeo-containers-0.1.20-2.el7.x86_64.rpm                                                                                                 | 7.8 kB  00:00:00     
192 (6/7): docker-client-1.12.6-32.git88a4867.el7.centos.x86_64.rpm                                                                                  | 3.2 MB  00:00:04     
193 (7/7): docker-1.12.6-32.git88a4867.el7.centos.x86_64.rpm                                                                                         |  14 MB  00:02:20     
194 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
195 总计                                                                                                                                    135 kB/s |  19 MB  00:02:20     
196file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 检索密钥
197 导入 GPG key 0xF4A80EB5:
198  用户ID     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
199  指纹       : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
200  软件包     : centos-release-7-1.1503.el7.centos.2.8.x86_64 (@anaconda)
201  来自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
202 Running transaction check
203 Running transaction test
204 Transaction test succeeded
205 Running transaction
206   正在更新    : libsepol-2.5-6.el7.x86_64                                                                                                                          1/67 
207   正在更新    : libselinux-2.5-6.el7.x86_64                                                                                                                        2/67 
208   正在更新    : systemd-libs-219-30.el7_3.9.x86_64                                                                                                                 3/67 
209   正在更新    : dracut-033-463.el7_3.2.x86_64                                                                                                                      4/67 
210   正在更新    : kmod-20-9.el7.x86_64                                                                                                                               5/67 
211   正在更新    : systemd-219-30.el7_3.9.x86_64                                                                                                                      6/67 
212   正在更新    : libsemanage-2.5-5.1.el7_3.x86_64                                                                                                                   7/67 
213   正在更新    : 7:device-mapper-libs-1.02.135-1.el7_3.5.x86_64                                                                                                     8/67 
214   正在更新    : 7:device-mapper-1.02.135-1.el7_3.5.x86_64                                                                                                          9/67 
215   正在更新    : 7:device-mapper-event-libs-1.02.135-1.el7_3.5.x86_64                                                                                              10/67 
216   正在更新    : libselinux-utils-2.5-6.el7.x86_64                                                                                                                 11/67 
217   正在更新    : policycoreutils-2.5-11.el7_3.x86_64                                                                                                               12/67 
218   正在更新    : selinux-policy-3.13.1-102.el7_3.16.noarch                                                                                                         13/67 
219   正在更新    : glib2-2.46.2-4.el7.x86_64                                                                                                                         14/67 
220   正在安装    : 2:docker-common-1.12.6-32.git88a4867.el7.centos.x86_64                                                                                            15/67 
221   正在安装    : 2:docker-client-1.12.6-32.git88a4867.el7.centos.x86_64                                                                                            16/67 
222   正在更新    : selinux-policy-targeted-3.13.1-102.el7_3.16.noarch                                                                                                17/67 
223   正在更新    : 7:device-mapper-event-1.02.135-1.el7_3.5.x86_64                                                                                                   18/67 
224   正在更新    : 7:lvm2-libs-2.02.166-1.el7_3.5.x86_64                                                                                                             19/67 
225   正在更新    : libsemanage-python-2.5-5.1.el7_3.x86_64                                                                                                           20/67 
226   正在安装    : 1:oci-register-machine-0-3.11.gitdd0daef.el7.x86_64                                                                                               21/67 
227   正在更新    : libselinux-python-2.5-6.el7.x86_64                                                                                                                22/67 
228   正在安装    : 1:oci-systemd-hook-0.1.7-4.gite533efa.el7.x86_64                                                                                                  23/67 
229   正在更新    : setools-libs-3.3.8-1.1.el7.x86_64                                                                                                                 24/67 
230   正在更新    : policycoreutils-python-2.5-11.el7_3.x86_64                                                                                                        25/67 
231   正在安装    : 2:container-selinux-2.19-2.1.el7.noarch                                                                                                           26/67 
232   正在安装    : 1:skopeo-containers-0.1.20-2.el7.x86_64                                                                                                           27/67 
233   正在更新    : device-mapper-persistent-data-0.6.3-1.el7.x86_64                                                                                                  28/67 
234   正在更新    : 7:lvm2-2.02.166-1.el7_3.5.x86_64                                                                                                                  29/67 
235 Created symlink from /etc/systemd/system/sysinit.target.wants/lvm2-lvmpolld.socket to /usr/lib/systemd/system/lvm2-lvmpolld.socket.
236 Stopping containers...
237 Cannot connect to the Docker daemon. Is the docker daemon running on this host?
238 "docker stop" requires at least 1 argument(s).
239 See 'docker stop --help'.
240 
241 Usage:  docker stop [OPTIONS] CONTAINER [CONTAINER...]
242 
243 Stop one or more running containers
244   正在安装    : 2:docker-1.12.6-32.git88a4867.el7.centos.x86_64                                                                                                   30/67 
245   正在更新    : 7:lvm2-python-libs-2.02.166-1.el7_3.5.x86_64                                                                                                      31/67 
246   正在更新    : initscripts-9.49.37-1.el7_3.1.x86_64                                                                                                              32/67 
247   正在更新    : libgudev1-219-30.el7_3.9.x86_64                                                                                                                   33/67 
248   正在更新    : systemd-sysv-219-30.el7_3.9.x86_64                                                                                                                34/67 
249   正在更新    : systemd-python-219-30.el7_3.9.x86_64                                                                                                              35/67 
250   正在更新    : dracut-config-rescue-033-463.el7_3.2.x86_64                                                                                                       36/67 
251   正在更新    : dracut-network-033-463.el7_3.2.x86_64                                                                                                             37/67 
252   清理        : 7:lvm2-2.02.115-3.el7.x86_64                                                                                                                      38/67 
253   清理        : selinux-policy-targeted-3.13.1-23.el7.noarch                                                                                                      39/67 
254   清理        : selinux-policy-3.13.1-23.el7.noarch                                                                                                               40/67 
255   清理        : systemd-sysv-208-20.el7.x86_64                                                                                                                    41/67 
256   清理        : dracut-network-033-240.el7.x86_64                                                                                                                 42/67 
257   清理        : dracut-config-rescue-033-240.el7.x86_64                                                                                                           43/67 
258   清理        : policycoreutils-python-2.2.5-15.el7.x86_64                                                                                                        44/67 
259   清理        : policycoreutils-2.2.5-15.el7.x86_64                                                                                                               45/67 
260   清理        : libgudev1-208-20.el7.x86_64                                                                                                                       46/67 
261   清理        : systemd-python-208-20.el7.x86_64                                                                                                                  47/67 
262   清理        : initscripts-9.49.24-1.el7.x86_64                                                                                                                  48/67 
263   清理        : setools-libs-3.3.7-46.el7.x86_64                                                                                                                  49/67 
264   清理        : dracut-033-240.el7.x86_64                                                                                                                         50/67 
265   清理        : glib2-2.40.0-4.el7.x86_64                                                                                                                         51/67 
266   清理        : libselinux-utils-2.2.2-6.el7.x86_64                                                                                                               52/67 
267   清理        : libselinux-python-2.2.2-6.el7.x86_64                                                                                                              53/67 
268   清理        : libsemanage-python-2.1.10-16.el7.x86_64                                                                                                           54/67 
269   清理        : libsemanage-2.1.10-16.el7.x86_64                                                                                                                  55/67 
270   清理        : 7:lvm2-python-libs-2.02.115-3.el7.x86_64                                                                                                          56/67 
271   清理        : 7:lvm2-libs-2.02.115-3.el7.x86_64                                                                                                                 57/67 
272   清理        : 7:device-mapper-event-1.02.93-3.el7.x86_64                                                                                                        58/67 
273   清理        : 7:device-mapper-event-libs-1.02.93-3.el7.x86_64                                                                                                   59/67 
274   清理        : 7:device-mapper-1.02.93-3.el7.x86_64                                                                                                              60/67 
275   清理        : 7:device-mapper-libs-1.02.93-3.el7.x86_64                                                                                                         61/67 
276   清理        : systemd-208-20.el7.x86_64                                                                                                                         62/67 
277   清理        : systemd-libs-208-20.el7.x86_64                                                                                                                    63/67 
278   清理        : libselinux-2.2.2-6.el7.x86_64                                                                                                                     64/67 
279   清理        : libsepol-2.1.9-3.el7.x86_64                                                                                                                       65/67 
280   清理        : kmod-14-10.el7.x86_64                                                                                                                             66/67 
281   清理        : device-mapper-persistent-data-0.4.1-2.el7.x86_64                                                                                                  67/67 
282   验证中      : 7:lvm2-2.02.166-1.el7_3.5.x86_64                                                                                                                   1/67 
283   验证中      : dracut-config-rescue-033-463.el7_3.2.x86_64                                                                                                        2/67 
284   验证中      : device-mapper-persistent-data-0.6.3-1.el7.x86_64                                                                                                   3/67 
285   验证中      : selinux-policy-3.13.1-102.el7_3.16.noarch                                                                                                          4/67 
286   验证中      : 7:lvm2-libs-2.02.166-1.el7_3.5.x86_64                                                                                                              5/67 
287   验证中      : 7:lvm2-python-libs-2.02.166-1.el7_3.5.x86_64                                                                                                       6/67 
288   验证中      : dracut-network-033-463.el7_3.2.x86_64                                                                                                              7/67 
289   验证中      : policycoreutils-python-2.5-11.el7_3.x86_64                                                                                                         8/67 
290   验证中      : 2:container-selinux-2.19-2.1.el7.noarch                                                                                                            9/67 
291   验证中      : libselinux-python-2.5-6.el7.x86_64                                                                                                                10/67 
292   验证中      : 1:oci-register-machine-0-3.11.gitdd0daef.el7.x86_64                                                                                               11/67 
293   验证中      : 1:skopeo-containers-0.1.20-2.el7.x86_64                                                                                                           12/67 
294   验证中      : libselinux-utils-2.5-6.el7.x86_64                                                                                                                 13/67 
295   验证中      : 7:device-mapper-event-1.02.135-1.el7_3.5.x86_64                                                                                                   14/67 
296   验证中      : policycoreutils-2.5-11.el7_3.x86_64                                                                                                               15/67 
297   验证中      : kmod-20-9.el7.x86_64                                                                                                                              16/67 
298   验证中      : dracut-033-463.el7_3.2.x86_64                                                                                                                     17/67 
299   验证中      : selinux-policy-targeted-3.13.1-102.el7_3.16.noarch                                                                                                18/67 
300   验证中      : initscripts-9.49.37-1.el7_3.1.x86_64                                                                                                              19/67 
301   验证中      : libsemanage-2.5-5.1.el7_3.x86_64                                                                                                                  20/67 
302   验证中      : 2:docker-client-1.12.6-32.git88a4867.el7.centos.x86_64                                                                                            21/67 
303   验证中      : libsepol-2.5-6.el7.x86_64                                                                                                                         22/67 
304   验证中      : systemd-sysv-219-30.el7_3.9.x86_64                                                                                                                23/67 
305   验证中      : 1:oci-systemd-hook-0.1.7-4.gite533efa.el7.x86_64                                                                                                  24/67 
306   验证中      : systemd-python-219-30.el7_3.9.x86_64                                                                                                              25/67 
307   验证中      : 7:device-mapper-1.02.135-1.el7_3.5.x86_64                                                                                                         26/67 
308   验证中      : libselinux-2.5-6.el7.x86_64                                                                                                                       27/67 
309   验证中      : glib2-2.46.2-4.el7.x86_64                                                                                                                         28/67 
310   验证中      : 2:docker-1.12.6-32.git88a4867.el7.centos.x86_64                                                                                                   29/67 
311   验证中      : libgudev1-219-30.el7_3.9.x86_64                                                                                                                   30/67 
312   验证中      : libsemanage-python-2.5-5.1.el7_3.x86_64                                                                                                           31/67 
313   验证中      : 7:device-mapper-libs-1.02.135-1.el7_3.5.x86_64                                                                                                    32/67 
314   验证中      : 2:docker-common-1.12.6-32.git88a4867.el7.centos.x86_64                                                                                            33/67 
315   验证中      : systemd-libs-219-30.el7_3.9.x86_64                                                                                                                34/67 
316   验证中      : 7:device-mapper-event-libs-1.02.135-1.el7_3.5.x86_64                                                                                              35/67 
317   验证中      : systemd-219-30.el7_3.9.x86_64                                                                                                                     36/67 
318   验证中      : setools-libs-3.3.8-1.1.el7.x86_64                                                                                                                 37/67 
319   验证中      : 7:lvm2-2.02.115-3.el7.x86_64                                                                                                                      38/67 
320   验证中      : 7:device-mapper-event-1.02.93-3.el7.x86_64                                                                                                        39/67 
321   验证中      : dracut-network-033-240.el7.x86_64                                                                                                                 40/67 
322   验证中      : kmod-14-10.el7.x86_64                                                                                                                             41/67 
323   验证中      : setools-libs-3.3.7-46.el7.x86_64                                                                                                                  42/67 
324   验证中      : selinux-policy-targeted-3.13.1-23.el7.noarch                                                                                                      43/67 
325   验证中      : 7:lvm2-libs-2.02.115-3.el7.x86_64                                                                                                                 44/67 
326   验证中      : policycoreutils-2.2.5-15.el7.x86_64                                                                                                               45/67 
327   验证中      : libgudev1-208-20.el7.x86_64                                                                                                                       46/67 
328   验证中      : policycoreutils-python-2.2.5-15.el7.x86_64                                                                                                        47/67 
329   验证中      : libselinux-utils-2.2.2-6.el7.x86_64                                                                                                               48/67 
330   验证中      : dracut-config-rescue-033-240.el7.x86_64                                                                                                           49/67 
331   验证中      : glib2-2.40.0-4.el7.x86_64                                                                                                                         50/67 
332   验证中      : systemd-208-20.el7.x86_64                                                                                                                         51/67 
333   验证中      : selinux-policy-3.13.1-23.el7.noarch                                                                                                               52/67 
334   验证中      : initscripts-9.49.24-1.el7.x86_64                                                                                                                  53/67 
335   验证中      : libsemanage-2.1.10-16.el7.x86_64                                                                                                                  54/67 
336   验证中      : systemd-libs-208-20.el7.x86_64                                                                                                                    55/67 
337   验证中      : libsepol-2.1.9-3.el7.x86_64                                                                                                                       56/67 
338   验证中      : 7:lvm2-python-libs-2.02.115-3.el7.x86_64                                                                                                          57/67 
339   验证中      : 7:device-mapper-1.02.93-3.el7.x86_64                                                                                                              58/67 
340   验证中      : systemd-sysv-208-20.el7.x86_64                                                                                                                    59/67 
341   验证中      : dracut-033-240.el7.x86_64                                                                                                                         60/67 
342   验证中      : libselinux-python-2.2.2-6.el7.x86_64                                                                                                              61/67 
343   验证中      : libsemanage-python-2.1.10-16.el7.x86_64                                                                                                           62/67 
344   验证中      : systemd-python-208-20.el7.x86_64                                                                                                                  63/67 
345   验证中      : 7:device-mapper-libs-1.02.93-3.el7.x86_64                                                                                                         64/67 
346   验证中      : device-mapper-persistent-data-0.4.1-2.el7.x86_64                                                                                                  65/67 
347   验证中      : 7:device-mapper-event-libs-1.02.93-3.el7.x86_64                                                                                                   66/67 
348   验证中      : libselinux-2.2.2-6.el7.x86_64                                                                                                                     67/67 
349 
350 已安装:
351   docker.x86_64 2:1.12.6-32.git88a4867.el7.centos                                                                                                                       
352 
353 作为依赖被安装:
354   container-selinux.noarch 2:2.19-2.1.el7              docker-client.x86_64 2:1.12.6-32.git88a4867.el7.centos  docker-common.x86_64 2:1.12.6-32.git88a4867.el7.centos 
355   oci-register-machine.x86_64 1:0-3.11.gitdd0daef.el7  oci-systemd-hook.x86_64 1:0.1.7-4.gite533efa.el7        skopeo-containers.x86_64 1:0.1.20-2.el7                
356 
357 更新完毕:
358   dracut.x86_64 0:033-463.el7_3.2                                                 initscripts.x86_64 0:9.49.37-1.el7_3.1                                                
359 
360 作为依赖被升级:
361   device-mapper.x86_64 7:1.02.135-1.el7_3.5          device-mapper-event.x86_64 7:1.02.135-1.el7_3.5          device-mapper-event-libs.x86_64 7:1.02.135-1.el7_3.5    
362   device-mapper-libs.x86_64 7:1.02.135-1.el7_3.5     device-mapper-persistent-data.x86_64 0:0.6.3-1.el7       dracut-config-rescue.x86_64 0:033-463.el7_3.2           
363   dracut-network.x86_64 0:033-463.el7_3.2            glib2.x86_64 0:2.46.2-4.el7                              kmod.x86_64 0:20-9.el7                                  
364   libgudev1.x86_64 0:219-30.el7_3.9                  libselinux.x86_64 0:2.5-6.el7                            libselinux-python.x86_64 0:2.5-6.el7                    
365   libselinux-utils.x86_64 0:2.5-6.el7                libsemanage.x86_64 0:2.5-5.1.el7_3                       libsemanage-python.x86_64 0:2.5-5.1.el7_3               
366   libsepol.x86_64 0:2.5-6.el7                        lvm2.x86_64 7:2.02.166-1.el7_3.5                         lvm2-libs.x86_64 7:2.02.166-1.el7_3.5                   
367   lvm2-python-libs.x86_64 7:2.02.166-1.el7_3.5       policycoreutils.x86_64 0:2.5-11.el7_3                    policycoreutils-python.x86_64 0:2.5-11.el7_3            
368   selinux-policy.noarch 0:3.13.1-102.el7_3.16        selinux-policy-targeted.noarch 0:3.13.1-102.el7_3.16     setools-libs.x86_64 0:3.3.8-1.1.el7                     
369   systemd.x86_64 0:219-30.el7_3.9                    systemd-libs.x86_64 0:219-30.el7_3.9                     systemd-python.x86_64 0:219-30.el7_3.9                  
370   systemd-sysv.x86_64 0:219-30.el7_3.9              
371 
372 完毕!
View Code

 3 、启动docker服务

[root@localhost ~]# service docker start
Redirecting to /bin/systemctl start  docker.service
[root@localhost ~]# 

4、测试运行 hello-world

[root@localhost ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
Trying to pull repository docker.io/library/hello-world ... 
latest: Pulling from docker.io/library/hello-world
b04784fba78d: Pull complete 
Digest: sha256:f3b3b28a45160805bb16542c9531888519430e9e6d6ffc09d72261b0d26ff74f

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.
 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://cloud.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/

 参考 http://www.runoob.com/docker/docker-tutorial.html

原文地址:https://www.cnblogs.com/xd502djj/p/7374159.html