Docker 是一個(gè)開源的應(yīng)用容器引擎,基于 Go 語言 并遵從Apache2.0協(xié)議開源写半。Docker 可以讓開發(fā)者打包應(yīng)用以及依賴包到一個(gè)輕量級(jí)岸蜗、可移植的容器中,然后發(fā)布到任何流行的 Linux 機(jī)器上叠蝇,也可以實(shí)現(xiàn)虛擬化璃岳。容器是完全使用沙箱機(jī)制,相互之間不會(huì)有任何接口,更重要的是容器性能開銷極低悔捶。其官網(wǎng)是http://www.docker.com
一铃慷、安裝Docker 和Docker Compose
yum intstall docker docker-compose
安裝過程中會(huì)詢問是否確認(rèn)安裝,需要輸入y 來確認(rèn)安裝蜕该。
安裝過程如下:
[root@localhost ~]# yum install docker docker-compose
已加載插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.lzu.edu.cn
* extras: mirror.lzu.edu.cn
* updates: mirror.lzu.edu.cn
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): extras/7/x86_64/primary_db | 205 kB 00:00:00
(3/4): updates/7/x86_64/primary_db | 6.4 MB 00:00:05
(4/4): base/7/x86_64/primary_db | 6.0 MB 00:00:07
沒有可用軟件包 docker-compose犁柜。
正在解決依賴關(guān)系
--> 正在檢查事務(wù)
---> 軟件包 docker.x86_64.2.1.13.1-96.gitb2f74b2.el7.centos 將被 安裝
--> 正在處理依賴關(guān)系 docker-common = 2:1.13.1-96.gitb2f74b2.el7.centos,它被軟件包 2:docker-1.13.1-96.gitb2f74b2.el7.centos.x86_64 需要
--> 正在處理依賴關(guān)系 docker-client = 2:1.13.1-96.gitb2f74b2.el7.centos堂淡,它被軟件包 2:docker-1.13.1-96.gitb2f74b2.el7.centos.x86_64 需要
--> 正在處理依賴關(guān)系 subscription-manager-rhsm-certificates赁温,它被軟件包 2:docker-1.13.1-96.gitb2f74b2.el7.centos.x86_64 需要
--> 正在檢查事務(wù)
---> 軟件包 docker-client.x86_64.2.1.13.1-96.gitb2f74b2.el7.centos 將被 安裝
---> 軟件包 docker-common.x86_64.2.1.13.1-96.gitb2f74b2.el7.centos 將被 安裝
--> 正在處理依賴關(guān)系 skopeo-containers >= 1:0.1.26-2,它被軟件包 2:docker-common-1.13.1-96.gitb2f74b2.el7.centos.x86_64 需要
--> 正在處理依賴關(guān)系 oci-umount >= 2:2.3.3-3淤齐,它被軟件包 2:docker-common-1.13.1-96.gitb2f74b2.el7.centos.x86_64 需要
--> 正在處理依賴關(guān)系 oci-systemd-hook >= 1:0.1.4-9股囊,它被軟件包 2:docker-common-1.13.1-96.gitb2f74b2.el7.centos.x86_64 需要
--> 正在處理依賴關(guān)系 oci-register-machine >= 1:0-5.13,它被軟件包 2:docker-common-1.13.1-96.gitb2f74b2.el7.centos.x86_64 需要
--> 正在處理依賴關(guān)系 container-storage-setup >= 0.9.0-1更啄,它被軟件包 2:docker-common-1.13.1-96.gitb2f74b2.el7.centos.x86_64 需要
--> 正在處理依賴關(guān)系 container-selinux >= 2:2.51-1稚疹,它被軟件包 2:docker-common-1.13.1-96.gitb2f74b2.el7.centos.x86_64 需要
--> 正在處理依賴關(guān)系 atomic-registries,它被軟件包 2:docker-common-1.13.1-96.gitb2f74b2.el7.centos.x86_64 需要
---> 軟件包 subscription-manager-rhsm-certificates.x86_64.0.1.21.10-3.el7.centos 將被 安裝
--> 正在檢查事務(wù)
---> 軟件包 atomic-registries.x86_64.1.1.22.1-26.gitb507039.el7.centos 將被 安裝
--> 正在處理依賴關(guān)系 python-yaml,它被軟件包 1:atomic-registries-1.22.1-26.gitb507039.el7.centos.x86_64 需要
--> 正在處理依賴關(guān)系 python-setuptools内狗,它被軟件包 1:atomic-registries-1.22.1-26.gitb507039.el7.centos.x86_64 需要
--> 正在處理依賴關(guān)系 python-pytoml怪嫌,它被軟件包 1:atomic-registries-1.22.1-26.gitb507039.el7.centos.x86_64 需要
---> 軟件包 container-selinux.noarch.2.2.99-1.el7_6 將被 安裝
--> 正在處理依賴關(guān)系 selinux-policy-targeted >= 3.13.1-216.el7,它被軟件包 2:container-selinux-2.99-1.el7_6.noarch 需要
--> 正在處理依賴關(guān)系 selinux-policy-base >= 3.13.1-216.el7柳沙,它被軟件包 2:container-selinux-2.99-1.el7_6.noarch 需要
--> 正在處理依賴關(guān)系 selinux-policy >= 3.13.1-216.el7岩灭,它被軟件包 2:container-selinux-2.99-1.el7_6.noarch 需要
--> 正在處理依賴關(guān)系 policycoreutils-python,它被軟件包 2:container-selinux-2.99-1.el7_6.noarch 需要
---> 軟件包 container-storage-setup.noarch.0.0.11.0-2.git5eaf76c.el7 將被 安裝
---> 軟件包 containers-common.x86_64.1.0.1.35-2.git404c5bd.el7.centos 將被 安裝
---> 軟件包 oci-register-machine.x86_64.1.0-6.git2b44233.el7 將被 安裝
---> 軟件包 oci-systemd-hook.x86_64.1.0.2.0-1.git05e6923.el7_6 將被 安裝
--> 正在處理依賴關(guān)系 libyajl.so.2()(64bit)赂鲤,它被軟件包 1:oci-systemd-hook-0.2.0-1.git05e6923.el7_6.x86_64 需要
---> 軟件包 oci-umount.x86_64.2.2.3.4-2.git87f9237.el7 將被 安裝
--> 正在檢查事務(wù)
---> 軟件包 PyYAML.x86_64.0.3.10-11.el7 將被 安裝
--> 正在處理依賴關(guān)系 libyaml-0.so.2()(64bit)噪径,它被軟件包 PyYAML-3.10-11.el7.x86_64 需要
---> 軟件包 policycoreutils-python.x86_64.0.2.5-29.el7_6.1 將被 安裝
--> 正在處理依賴關(guān)系 policycoreutils = 2.5-29.el7_6.1,它被軟件包 policycoreutils-python-2.5-29.el7_6.1.x86_64 需要
--> 正在處理依賴關(guān)系 setools-libs >= 3.3.8-4数初,它被軟件包 policycoreutils-python-2.5-29.el7_6.1.x86_64 需要
--> 正在處理依賴關(guān)系 libsemanage-python >= 2.5-14找爱,它被軟件包 policycoreutils-python-2.5-29.el7_6.1.x86_64 需要
--> 正在處理依賴關(guān)系 audit-libs-python >= 2.1.3-4,它被軟件包 policycoreutils-python-2.5-29.el7_6.1.x86_64 需要
--> 正在處理依賴關(guān)系 python-IPy泡孩,它被軟件包 policycoreutils-python-2.5-29.el7_6.1.x86_64 需要
--> 正在處理依賴關(guān)系 libqpol.so.1(VERS_1.4)(64bit)车摄,它被軟件包 policycoreutils-python-2.5-29.el7_6.1.x86_64 需要
--> 正在處理依賴關(guān)系 libqpol.so.1(VERS_1.2)(64bit),它被軟件包 policycoreutils-python-2.5-29.el7_6.1.x86_64 需要
--> 正在處理依賴關(guān)系 libcgroup仑鸥,它被軟件包 policycoreutils-python-2.5-29.el7_6.1.x86_64 需要
--> 正在處理依賴關(guān)系 libapol.so.4(VERS_4.0)(64bit)吮播,它被軟件包 policycoreutils-python-2.5-29.el7_6.1.x86_64 需要
--> 正在處理依賴關(guān)系 checkpolicy,它被軟件包 policycoreutils-python-2.5-29.el7_6.1.x86_64 需要
--> 正在處理依賴關(guān)系 libqpol.so.1()(64bit)眼俊,它被軟件包 policycoreutils-python-2.5-29.el7_6.1.x86_64 需要
--> 正在處理依賴關(guān)系 libapol.so.4()(64bit)意狠,它被軟件包 policycoreutils-python-2.5-29.el7_6.1.x86_64 需要
---> 軟件包 python-pytoml.noarch.0.0.1.14-1.git7dea353.el7 將被 安裝
---> 軟件包 python-setuptools.noarch.0.0.9.8-7.el7 將被 安裝
--> 正在處理依賴關(guān)系 python-backports-ssl_match_hostname,它被軟件包 python-setuptools-0.9.8-7.el7.noarch 需要
---> 軟件包 selinux-policy.noarch.0.3.13.1-192.el7 將被 升級(jí)
---> 軟件包 selinux-policy.noarch.0.3.13.1-229.el7_6.12 將被 更新
--> 正在處理依賴關(guān)系 libsemanage >= 2.5-13泵琳,它被軟件包 selinux-policy-3.13.1-229.el7_6.12.noarch 需要
---> 軟件包 selinux-policy-targeted.noarch.0.3.13.1-192.el7 將被 升級(jí)
---> 軟件包 selinux-policy-targeted.noarch.0.3.13.1-229.el7_6.12 將被 更新
---> 軟件包 yajl.x86_64.0.2.0.4-4.el7 將被 安裝
--> 正在檢查事務(wù)
---> 軟件包 audit-libs-python.x86_64.0.2.8.4-4.el7 將被 安裝
--> 正在處理依賴關(guān)系 audit-libs(x86-64) = 2.8.4-4.el7摄职,它被軟件包 audit-libs-python-2.8.4-4.el7.x86_64 需要
---> 軟件包 checkpolicy.x86_64.0.2.5-8.el7 將被 安裝
---> 軟件包 libcgroup.x86_64.0.0.41-20.el7 將被 安裝
---> 軟件包 libsemanage.x86_64.0.2.5-11.el7 將被 升級(jí)
---> 軟件包 libsemanage.x86_64.0.2.5-14.el7 將被 更新
--> 正在處理依賴關(guān)系 libsepol >= 2.5-10,它被軟件包 libsemanage-2.5-14.el7.x86_64 需要
--> 正在處理依賴關(guān)系 libselinux >= 2.5-14获列,它被軟件包 libsemanage-2.5-14.el7.x86_64 需要
---> 軟件包 libsemanage-python.x86_64.0.2.5-14.el7 將被 安裝
---> 軟件包 libyaml.x86_64.0.0.1.4-11.el7_0 將被 安裝
---> 軟件包 policycoreutils.x86_64.0.2.5-22.el7 將被 升級(jí)
---> 軟件包 policycoreutils.x86_64.0.2.5-29.el7_6.1 將被 更新
--> 正在處理依賴關(guān)系 libselinux-utils >= 2.5-14谷市,它被軟件包 policycoreutils-2.5-29.el7_6.1.x86_64 需要
---> 軟件包 python-IPy.noarch.0.0.75-6.el7 將被 安裝
---> 軟件包 python-backports-ssl_match_hostname.noarch.0.3.5.0.1-1.el7 將被 安裝
--> 正在處理依賴關(guān)系 python-ipaddress,它被軟件包 python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch 需要
--> 正在處理依賴關(guān)系 python-backports击孩,它被軟件包 python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch 需要
---> 軟件包 setools-libs.x86_64.0.3.3.8-4.el7 將被 安裝
--> 正在檢查事務(wù)
---> 軟件包 audit-libs.x86_64.0.2.8.1-3.el7 將被 升級(jí)
--> 正在處理依賴關(guān)系 audit-libs(x86-64) = 2.8.1-3.el7迫悠,它被軟件包 audit-2.8.1-3.el7.x86_64 需要
---> 軟件包 audit-libs.x86_64.0.2.8.4-4.el7 將被 更新
---> 軟件包 libselinux.x86_64.0.2.5-12.el7 將被 升級(jí)
--> 正在處理依賴關(guān)系 libselinux(x86-64) = 2.5-12.el7,它被軟件包 libselinux-python-2.5-12.el7.x86_64 需要
---> 軟件包 libselinux.x86_64.0.2.5-14.1.el7 將被 更新
---> 軟件包 libselinux-utils.x86_64.0.2.5-12.el7 將被 升級(jí)
---> 軟件包 libselinux-utils.x86_64.0.2.5-14.1.el7 將被 更新
---> 軟件包 libsepol.x86_64.0.2.5-8.1.el7 將被 升級(jí)
---> 軟件包 libsepol.x86_64.0.2.5-10.el7 將被 更新
---> 軟件包 python-backports.x86_64.0.1.0-8.el7 將被 安裝
---> 軟件包 python-ipaddress.noarch.0.1.0.16-2.el7 將被 安裝
--> 正在檢查事務(wù)
---> 軟件包 audit.x86_64.0.2.8.1-3.el7 將被 升級(jí)
---> 軟件包 audit.x86_64.0.2.8.4-4.el7 將被 更新
---> 軟件包 libselinux-python.x86_64.0.2.5-12.el7 將被 升級(jí)
---> 軟件包 libselinux-python.x86_64.0.2.5-14.1.el7 將被 更新
--> 解決依賴關(guān)系完成
依賴關(guān)系解決
============================================================================================================================
Package 架構(gòu) 版本 源 大小
============================================================================================================================
正在安裝:
docker x86_64 2:1.13.1-96.gitb2f74b2.el7.centos extras 18 M
為依賴而安裝:
PyYAML x86_64 3.10-11.el7 base 153 k
atomic-registries x86_64 1:1.22.1-26.gitb507039.el7.centos extras 35 k
audit-libs-python x86_64 2.8.4-4.el7 base 76 k
checkpolicy x86_64 2.5-8.el7 base 295 k
container-selinux noarch 2:2.99-1.el7_6 extras 39 k
container-storage-setup noarch 0.11.0-2.git5eaf76c.el7 extras 35 k
containers-common x86_64 1:0.1.35-2.git404c5bd.el7.centos extras 21 k
docker-client x86_64 2:1.13.1-96.gitb2f74b2.el7.centos extras 3.9 M
docker-common x86_64 2:1.13.1-96.gitb2f74b2.el7.centos extras 96 k
libcgroup x86_64 0.41-20.el7 base 66 k
libsemanage-python x86_64 2.5-14.el7 base 113 k
libyaml x86_64 0.1.4-11.el7_0 base 55 k
oci-register-machine x86_64 1:0-6.git2b44233.el7 extras 1.1 M
oci-systemd-hook x86_64 1:0.2.0-1.git05e6923.el7_6 extras 34 k
oci-umount x86_64 2:2.3.4-2.git87f9237.el7 extras 32 k
policycoreutils-python x86_64 2.5-29.el7_6.1 updates 456 k
python-IPy noarch 0.75-6.el7 base 32 k
python-backports x86_64 1.0-8.el7 base 5.8 k
python-backports-ssl_match_hostname noarch 3.5.0.1-1.el7 base 13 k
python-ipaddress noarch 1.0.16-2.el7 base 34 k
python-pytoml noarch 0.1.14-1.git7dea353.el7 extras 18 k
python-setuptools noarch 0.9.8-7.el7 base 397 k
setools-libs x86_64 3.3.8-4.el7 base 620 k
subscription-manager-rhsm-certificates x86_64 1.21.10-3.el7.centos updates 207 k
yajl x86_64 2.0.4-4.el7 base 39 k
為依賴而更新:
audit x86_64 2.8.4-4.el7 base 250 k
audit-libs x86_64 2.8.4-4.el7 base 100 k
libselinux x86_64 2.5-14.1.el7 base 162 k
libselinux-python x86_64 2.5-14.1.el7 base 235 k
libselinux-utils x86_64 2.5-14.1.el7 base 151 k
libsemanage x86_64 2.5-14.el7 base 151 k
libsepol x86_64 2.5-10.el7 base 297 k
policycoreutils x86_64 2.5-29.el7_6.1 updates 916 k
selinux-policy noarch 3.13.1-229.el7_6.12 updates 484 k
selinux-policy-targeted noarch 3.13.1-229.el7_6.12 updates 6.9 M
事務(wù)概要
============================================================================================================================
安裝 1 軟件包 (+25 依賴軟件包)
升級(jí) ( 10 依賴軟件包)
總下載量:35 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
警告:/var/cache/yum/x86_64/7/extras/packages/atomic-registries-1.22.1-26.gitb507039.el7.centos.x86_64.rpm: 頭V3 RSA/SHA256 Signature, 密鑰 ID f4a80eb5: NOKEY
atomic-registries-1.22.1-26.gitb507039.el7.centos.x86_64.rpm 的公鑰尚未安裝
(1/36): atomic-registries-1.22.1-26.gitb507039.el7.centos.x86_64.rpm | 35 kB 00:00:00
PyYAML-3.10-11.el7.x86_64.rpm 的公鑰尚未安裝
(2/36): PyYAML-3.10-11.el7.x86_64.rpm | 153 kB 00:00:00
(3/36): audit-2.8.4-4.el7.x86_64.rpm | 250 kB 00:00:00
(4/36): audit-libs-python-2.8.4-4.el7.x86_64.rpm | 76 kB 00:00:00
(5/36): container-storage-setup-0.11.0-2.git5eaf76c.el7.noarch.rpm | 35 kB 00:00:00
(6/36): container-selinux-2.99-1.el7_6.noarch.rpm | 39 kB 00:00:00
(7/36): containers-common-0.1.35-2.git404c5bd.el7.centos.x86_64.rpm | 21 kB 00:00:00
(8/36): docker-common-1.13.1-96.gitb2f74b2.el7.centos.x86_64.rpm | 96 kB 00:00:00
(9/36): libcgroup-0.41-20.el7.x86_64.rpm | 66 kB 00:00:00
(10/36): checkpolicy-2.5-8.el7.x86_64.rpm | 295 kB 00:00:01
(11/36): libselinux-python-2.5-14.1.el7.x86_64.rpm | 235 kB 00:00:00
(12/36): libselinux-2.5-14.1.el7.x86_64.rpm | 162 kB 00:00:00
(13/36): libselinux-utils-2.5-14.1.el7.x86_64.rpm | 151 kB 00:00:00
(14/36): libsemanage-2.5-14.el7.x86_64.rpm | 151 kB 00:00:00
(15/36): libsemanage-python-2.5-14.el7.x86_64.rpm | 113 kB 00:00:00
(16/36): libyaml-0.1.4-11.el7_0.x86_64.rpm | 55 kB 00:00:00
(17/36): libsepol-2.5-10.el7.x86_64.rpm | 297 kB 00:00:00
(18/36): oci-register-machine-0-6.git2b44233.el7.x86_64.rpm | 1.1 MB 00:00:01
(19/36): oci-umount-2.3.4-2.git87f9237.el7.x86_64.rpm | 32 kB 00:00:00
policycoreutils-2.5-29.el7_6.1.x86_64.rpm 的公鑰尚未安裝========- ] 1.4 MB/s | 11 MB 00:00:16 ETA
(20/36): policycoreutils-2.5-29.el7_6.1.x86_64.rpm | 916 kB 00:00:01
(21/36): policycoreutils-python-2.5-29.el7_6.1.x86_64.rpm | 456 kB 00:00:00
(22/36): docker-client-1.13.1-96.gitb2f74b2.el7.centos.x86_64.rpm | 3.9 MB 00:00:06
(23/36): python-IPy-0.75-6.el7.noarch.rpm | 32 kB 00:00:00
(24/36): python-backports-1.0-8.el7.x86_64.rpm | 5.8 kB 00:00:00
(25/36): python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm | 13 kB 00:00:00
(26/36): python-ipaddress-1.0.16-2.el7.noarch.rpm | 34 kB 00:00:00
(27/36): python-pytoml-0.1.14-1.git7dea353.el7.noarch.rpm | 18 kB 00:00:00
(28/36): python-setuptools-0.9.8-7.el7.noarch.rpm | 397 kB 00:00:00
(29/36): selinux-policy-3.13.1-229.el7_6.12.noarch.rpm | 484 kB 00:00:00
(30/36): setools-libs-3.3.8-4.el7.x86_64.rpm | 620 kB 00:00:00
(31/36): docker-1.13.1-96.gitb2f74b2.el7.centos.x86_64.rpm | 18 MB 00:00:17
(32/36): yajl-2.0.4-4.el7.x86_64.rpm | 39 kB 00:00:00
audit-libs-2.8.4-4.el7.x86_64. FAILED ====== ] 1.3 MB/s | 30 MB 00:00:03 ETA
http://mirrors.njupt.edu.cn/centos/7.6.1810/os/x86_64/Packages/audit-libs-2.8.4-4.el7.x86_64.rpm: [Errno 14] HTTP Error 302 - Found
正在嘗試其它鏡像巩梢。
(33/36): audit-libs-2.8.4-4.el7.x86_64.rpm | 100 kB 00:00:00
(34/36): selinux-policy-targeted-3.13.1-229.el7_6.12.noarch.rpm | 6.9 MB 00:00:15
oci-systemd-hook-0.2.0-1.git05 FAILED
http://mirrors.njupt.edu.cn/centos/7.6.1810/extras/x86_64/Packages/oci-systemd-hook-0.2.0-1.git05e6923.el7_6.x86_64.rpm: [Errno 14] HTTP Error 302 - Found
正在嘗試其它鏡像创泄。
(35/36): oci-systemd-hook-0.2.0-1.git05e6923.el7_6.x86_64.rpm | 34 kB 00:00:00
subscription-manager-rhsm-cert FAILED
http://mirrors.njupt.edu.cn/centos/7.6.1810/updates/x86_64/Packages/subscription-manager-rhsm-certificates-1.21.10-3.el7.centos.x86_64.rpm: [Errno 14] HTTP Error 302 - Found
正在嘗試其它鏡像。
(36/36): subscription-manager-rhsm-certificates-1.21.10-3.el7.centos.x86_64.rpm | 207 kB 00:00:00
----------------------------------------------------------------------------------------------------------------------------
總計(jì) 1.1 MB/s | 35 MB 00:00:31
從 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 檢索密鑰
導(dǎo)入 GPG key 0xF4A80EB5:
用戶ID : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
指紋 : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
軟件包 : centos-release-7-5.1804.el7.centos.x86_64 (@anaconda)
來自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
是否繼續(xù)括蝠?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在更新 : libsepol-2.5-10.el7.x86_64 1/46
正在更新 : libselinux-2.5-14.1.el7.x86_64 2/46
正在更新 : audit-libs-2.8.4-4.el7.x86_64 3/46
正在更新 : libsemanage-2.5-14.el7.x86_64 4/46
正在更新 : libselinux-utils-2.5-14.1.el7.x86_64 5/46
正在更新 : policycoreutils-2.5-29.el7_6.1.x86_64 6/46
正在更新 : selinux-policy-3.13.1-229.el7_6.12.noarch 7/46
正在安裝 : yajl-2.0.4-4.el7.x86_64 8/46
正在安裝 : 2:oci-umount-2.3.4-2.git87f9237.el7.x86_64 9/46
正在安裝 : 1:oci-systemd-hook-0.2.0-1.git05e6923.el7_6.x86_64 10/46
正在更新 : selinux-policy-targeted-3.13.1-229.el7_6.12.noarch 11/46
正在安裝 : libsemanage-python-2.5-14.el7.x86_64 12/46
正在安裝 : audit-libs-python-2.8.4-4.el7.x86_64 13/46
正在安裝 : setools-libs-3.3.8-4.el7.x86_64 14/46
正在更新 : libselinux-python-2.5-14.1.el7.x86_64 15/46
正在安裝 : python-ipaddress-1.0.16-2.el7.noarch 16/46
正在安裝 : libyaml-0.1.4-11.el7_0.x86_64 17/46
正在安裝 : PyYAML-3.10-11.el7.x86_64 18/46
正在安裝 : python-backports-1.0-8.el7.x86_64 19/46
正在安裝 : python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch 20/46
正在安裝 : python-setuptools-0.9.8-7.el7.noarch 21/46
正在安裝 : 1:containers-common-0.1.35-2.git404c5bd.el7.centos.x86_64 22/46
正在安裝 : checkpolicy-2.5-8.el7.x86_64 23/46
正在安裝 : 1:oci-register-machine-0-6.git2b44233.el7.x86_64 24/46
正在安裝 : python-pytoml-0.1.14-1.git7dea353.el7.noarch 25/46
正在安裝 : 1:atomic-registries-1.22.1-26.gitb507039.el7.centos.x86_64 26/46
正在安裝 : python-IPy-0.75-6.el7.noarch 27/46
正在安裝 : subscription-manager-rhsm-certificates-1.21.10-3.el7.centos.x86_64 28/46
正在安裝 : container-storage-setup-0.11.0-2.git5eaf76c.el7.noarch 29/46
正在安裝 : libcgroup-0.41-20.el7.x86_64 30/46
正在安裝 : policycoreutils-python-2.5-29.el7_6.1.x86_64 31/46
正在安裝 : 2:container-selinux-2.99-1.el7_6.noarch 32/46
正在安裝 : 2:docker-common-1.13.1-96.gitb2f74b2.el7.centos.x86_64 33/46
正在安裝 : 2:docker-client-1.13.1-96.gitb2f74b2.el7.centos.x86_64 34/46
正在安裝 : 2:docker-1.13.1-96.gitb2f74b2.el7.centos.x86_64 35/46
正在更新 : audit-2.8.4-4.el7.x86_64 36/46
清理 : selinux-policy-targeted-3.13.1-192.el7.noarch 37/46
清理 : selinux-policy-3.13.1-192.el7.noarch 38/46
清理 : policycoreutils-2.5-22.el7.x86_64 39/46
清理 : libsemanage-2.5-11.el7.x86_64 40/46
清理 : libselinux-utils-2.5-12.el7.x86_64 41/46
清理 : libselinux-python-2.5-12.el7.x86_64 42/46
清理 : libselinux-2.5-12.el7.x86_64 43/46
清理 : audit-2.8.1-3.el7.x86_64 44/46
清理 : audit-libs-2.8.1-3.el7.x86_64 45/46
清理 : libsepol-2.5-8.1.el7.x86_64 46/46
驗(yàn)證中 : libcgroup-0.41-20.el7.x86_64 1/46
驗(yàn)證中 : python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch 2/46
驗(yàn)證中 : 2:docker-client-1.13.1-96.gitb2f74b2.el7.centos.x86_64 3/46
驗(yàn)證中 : container-storage-setup-0.11.0-2.git5eaf76c.el7.noarch 4/46
驗(yàn)證中 : python-setuptools-0.9.8-7.el7.noarch 5/46
驗(yàn)證中 : subscription-manager-rhsm-certificates-1.21.10-3.el7.centos.x86_64 6/46
驗(yàn)證中 : policycoreutils-python-2.5-29.el7_6.1.x86_64 7/46
驗(yàn)證中 : 2:oci-umount-2.3.4-2.git87f9237.el7.x86_64 8/46
驗(yàn)證中 : policycoreutils-2.5-29.el7_6.1.x86_64 9/46
驗(yàn)證中 : audit-libs-2.8.4-4.el7.x86_64 10/46
驗(yàn)證中 : audit-2.8.4-4.el7.x86_64 11/46
驗(yàn)證中 : python-IPy-0.75-6.el7.noarch 12/46
驗(yàn)證中 : 2:docker-common-1.13.1-96.gitb2f74b2.el7.centos.x86_64 13/46
驗(yàn)證中 : python-pytoml-0.1.14-1.git7dea353.el7.noarch 14/46
驗(yàn)證中 : selinux-policy-3.13.1-229.el7_6.12.noarch 15/46
驗(yàn)證中 : selinux-policy-targeted-3.13.1-229.el7_6.12.noarch 16/46
驗(yàn)證中 : 2:docker-1.13.1-96.gitb2f74b2.el7.centos.x86_64 17/46
驗(yàn)證中 : libsemanage-python-2.5-14.el7.x86_64 18/46
驗(yàn)證中 : 1:oci-systemd-hook-0.2.0-1.git05e6923.el7_6.x86_64 19/46
驗(yàn)證中 : setools-libs-3.3.8-4.el7.x86_64 20/46
驗(yàn)證中 : 1:oci-register-machine-0-6.git2b44233.el7.x86_64 21/46
驗(yàn)證中 : libsemanage-2.5-14.el7.x86_64 22/46
驗(yàn)證中 : libsepol-2.5-10.el7.x86_64 23/46
驗(yàn)證中 : checkpolicy-2.5-8.el7.x86_64 24/46
驗(yàn)證中 : 1:containers-common-0.1.35-2.git404c5bd.el7.centos.x86_64 25/46
驗(yàn)證中 : python-backports-1.0-8.el7.x86_64 26/46
驗(yàn)證中 : yajl-2.0.4-4.el7.x86_64 27/46
驗(yàn)證中 : 1:atomic-registries-1.22.1-26.gitb507039.el7.centos.x86_64 28/46
驗(yàn)證中 : libselinux-python-2.5-14.1.el7.x86_64 29/46
驗(yàn)證中 : audit-libs-python-2.8.4-4.el7.x86_64 30/46
驗(yàn)證中 : libyaml-0.1.4-11.el7_0.x86_64 31/46
驗(yàn)證中 : libselinux-utils-2.5-14.1.el7.x86_64 32/46
驗(yàn)證中 : python-ipaddress-1.0.16-2.el7.noarch 33/46
驗(yàn)證中 : PyYAML-3.10-11.el7.x86_64 34/46
驗(yàn)證中 : 2:container-selinux-2.99-1.el7_6.noarch 35/46
驗(yàn)證中 : libselinux-2.5-14.1.el7.x86_64 36/46
驗(yàn)證中 : libsemanage-2.5-11.el7.x86_64 37/46
驗(yàn)證中 : audit-libs-2.8.1-3.el7.x86_64 38/46
驗(yàn)證中 : policycoreutils-2.5-22.el7.x86_64 39/46
驗(yàn)證中 : selinux-policy-targeted-3.13.1-192.el7.noarch 40/46
驗(yàn)證中 : audit-2.8.1-3.el7.x86_64 41/46
驗(yàn)證中 : libsepol-2.5-8.1.el7.x86_64 42/46
驗(yàn)證中 : selinux-policy-3.13.1-192.el7.noarch 43/46
驗(yàn)證中 : libselinux-2.5-12.el7.x86_64 44/46
驗(yàn)證中 : libselinux-python-2.5-12.el7.x86_64 45/46
驗(yàn)證中 : libselinux-utils-2.5-12.el7.x86_64 46/46
已安裝:
docker.x86_64 2:1.13.1-96.gitb2f74b2.el7.centos
作為依賴被安裝:
PyYAML.x86_64 0:3.10-11.el7
atomic-registries.x86_64 1:1.22.1-26.gitb507039.el7.centos
audit-libs-python.x86_64 0:2.8.4-4.el7
checkpolicy.x86_64 0:2.5-8.el7
container-selinux.noarch 2:2.99-1.el7_6
container-storage-setup.noarch 0:0.11.0-2.git5eaf76c.el7
containers-common.x86_64 1:0.1.35-2.git404c5bd.el7.centos
docker-client.x86_64 2:1.13.1-96.gitb2f74b2.el7.centos
docker-common.x86_64 2:1.13.1-96.gitb2f74b2.el7.centos
libcgroup.x86_64 0:0.41-20.el7
libsemanage-python.x86_64 0:2.5-14.el7
libyaml.x86_64 0:0.1.4-11.el7_0
oci-register-machine.x86_64 1:0-6.git2b44233.el7
oci-systemd-hook.x86_64 1:0.2.0-1.git05e6923.el7_6
oci-umount.x86_64 2:2.3.4-2.git87f9237.el7
policycoreutils-python.x86_64 0:2.5-29.el7_6.1
python-IPy.noarch 0:0.75-6.el7
python-backports.x86_64 0:1.0-8.el7
python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7
python-ipaddress.noarch 0:1.0.16-2.el7
python-pytoml.noarch 0:0.1.14-1.git7dea353.el7
python-setuptools.noarch 0:0.9.8-7.el7
setools-libs.x86_64 0:3.3.8-4.el7
subscription-manager-rhsm-certificates.x86_64 0:1.21.10-3.el7.centos
yajl.x86_64 0:2.0.4-4.el7
作為依賴被升級(jí):
audit.x86_64 0:2.8.4-4.el7 audit-libs.x86_64 0:2.8.4-4.el7
libselinux.x86_64 0:2.5-14.1.el7 libselinux-python.x86_64 0:2.5-14.1.el7
libselinux-utils.x86_64 0:2.5-14.1.el7 libsemanage.x86_64 0:2.5-14.el7
libsepol.x86_64 0:2.5-10.el7 policycoreutils.x86_64 0:2.5-29.el7_6.1
selinux-policy.noarch 0:3.13.1-229.el7_6.12 selinux-policy-targeted.noarch 0:3.13.1-229.el7_6.12
完畢鞠抑!
安裝完成之后使用如下命令啟動(dòng)Docker服務(wù)
systemctl start docker
#查詢docker是否啟動(dòng)
ps -ef | grep docker
完整展示:
[root@localhost ~]# systemctl start docker
[root@localhost ~]# ps -ef | grep docker
root 2461 1 0 17:48 ? 00:00:00 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --init-path=/usr/libexec/docker/docker-init-current --seccomp-profile=/etc/docker/seccomp.json --selinux-enabled --log-driver=journald --signature-verification=false --storage-driver overlay2
root 2466 2461 0 17:48 ? 00:00:00 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --shimdocker-containerd-shim --runtime docker-runc --runtime-args --systemd-cgroup=true
root 2558 1501 0 17:50 pts/0 00:00:00 grep --color=auto docker
[root@localhost ~]#
二、系統(tǒng)啟動(dòng)停止Docker命令
如果服務(wù)器重啟忌警,或者Docker進(jìn)程被意外干掉了怎么辦呢搁拙?別擔(dān)心,下面就教您如何開啟和關(guān)閉Docker進(jìn)程。
# 啟動(dòng)Docker命令
systemctl start docker
# 停止Docker命令
systemctl stop docker
# 重啟Docker命令
systemctl restart docker
三箕速、簡(jiǎn)單的使用Docker
Docker 的HelloWorld
# 拉取hello-world鏡像
docker pull hello-world
# 運(yùn)行hello-world
docker run hello-world
執(zhí)行命令以及結(jié)果
[root@localhost ~]# docker pull hello-world
Using default tag: latest
Trying to pull repository docker.io/library/hello-world ...
latest: Pulling from docker.io/library/hello-world
1b930d010525: Pull complete
Digest: sha256:41a65640635299bab090f783209c1e3a3f11934cf7756b09cb2f1e02147c6ed8
Status: Downloaded newer image for docker.io/hello-world:latest
[root@localhost ~]# docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
命令解釋
docker pull hello-world : pull 表示拉取鏡像酪碘, hello-world 表示拉取的鏡像名,默認(rèn)拉取的是latest版本
docker run hello-world : run 表示運(yùn)行鏡像 盐茎,hello-world 表示拉取的鏡像名
四兴垦、小結(jié)
到這里CentOS 安裝Docker已經(jīng)安裝完成,但是值得注意的一點(diǎn)是Docker運(yùn)行的環(huán)境需要Linux的內(nèi)核大于3.10.0字柠,如果您不知道怎么查詢內(nèi)核版本探越,可以使用如下命令:
[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
如果您的內(nèi)核版本低于3.10.0,請(qǐng)使用 yum update 升級(jí)系統(tǒng)內(nèi)核募谎,但是這只是一個(gè)緩兵之計(jì)扶关,更好的辦法是換用很高版本的Linux發(fā)行版本阴汇,CentOS6的內(nèi)核就小于3.10.0哦数冬。如果使用的是Ubuntu等其他Linux系統(tǒng),升級(jí)系統(tǒng)內(nèi)核搀庶、啟動(dòng)和停止命令有些不同哦拐纱,這點(diǎn)一頂要注意。小伙伴們哥倔,你們知道如何安裝Docker了嗎秸架?是不是很簡(jiǎn)單呢?
任何形式的轉(zhuǎn)載都請(qǐng)聯(lián)系作者Jackieonway獲得授權(quán)并注明出處咆蒿。
微信搜索"JackieOnWay"關(guān)注我們东抹,第一時(shí)間獲取最新技術(shù)文摘。