我使用的是yum安装, 下面提供我的yum源。
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/fedora/25/
enabled=1
gpgcheck=0
检查内核
uname -r
4.13.9-300.fc27.x86_64
或者
uname -a
Linux localhost.localdomain 4.13.9-300.fc27.x86_64 #1 SMP Mon Oct 23 13:41:58 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
这个内核版本大于3.1.0即可
添加yum库
把上面的yum添加到/etc/yum.repos.d, 然后更新yum源, 如果更新失败, 则使用代理。
安装
yum install -y docker-engine
[root@localhost yum.repos.d]# yum install -y docker-engine
上次元数据过期检查:0:01:26 前,执行于 2018年01月09日 星期二 18时31分15秒。
依赖关系解决。
==========================================================================================================================================================================
软件包 架构 版本 仓库 大小
==========================================================================================================================================================================
安装:
docker-engine x86_64 17.05.0.ce-1.fc25 dockerrepo 20 M
正在安装安装依赖关系:
audit-libs-python x86_64 2.7.8-1.fc27 local_resource 81 k
checkpolicy x86_64 2.7-1.fc27 local_resource 330 k
docker-engine-selinux noarch 17.05.0.ce-1.fc25 dockerrepo 33 k
libcgroup x86_64 0.41-13.fc27 local_resource 67 k
libselinux-python x86_64 2.7-2.fc27 local_resource 250 k
libsemanage-python x86_64 2.7-1.fc27 local_resource 118 k
policycoreutils-python x86_64 2.7-1.fc27 local_resource 410 k
python-enum34 noarch 1.1.6-2.fc27 local_resource 57 k
python2-IPy noarch 0.81-20.fc27 local_resource 42 k
setools-python x86_64 4.1.1-3.fc27 local_resource 580 k
事务概要
==========================================================================================================================================================================
安装 11 软件包
总计:21 M
总下载:20 M
安装大小:78 M
下载软件包:
(1/2): docker-engine-selinux-17.05.0.ce-1.fc25.noarch.rpm 20 kB/s | 33 kB 00:01
(2/2): docker-engine-17.05.0.ce-1.fc25.x86_64.rpm 552 kB/s | 20 MB 00:36
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 553 kB/s | 20 MB 00:36
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
准备中 : 1/1
运行脚本: libcgroup-0.41-13.fc27.x86_64 1/11
安装 : libcgroup-0.41-13.fc27.x86_64 1/11
运行脚本: libcgroup-0.41-13.fc27.x86_64 1/11
安装 : python-enum34-1.1.6-2.fc27.noarch 2/11
安装 : setools-python-4.1.1-3.fc27.x86_64 3/11
安装 : python2-IPy-0.81-20.fc27.noarch 4/11
安装 : libsemanage-python-2.7-1.fc27.x86_64 5/11
安装 : libselinux-python-2.7-2.fc27.x86_64 6/11
安装 : checkpolicy-2.7-1.fc27.x86_64 7/11
安装 : audit-libs-python-2.7.8-1.fc27.x86_64 8/11
安装 : policycoreutils-python-2.7-1.fc27.x86_64 9/11
安装 : docker-engine-selinux-17.05.0.ce-1.fc25.noarch 10/11
运行脚本: docker-engine-selinux-17.05.0.ce-1.fc25.noarch 10/11
neverallow check failed at /var/lib/selinux/targeted/tmp/modules/100/base/cil:8988
(neverallow base_typeattr_7 unlabeled_t (file (entrypoint)))
<root>
allow at /var/lib/selinux/targeted/tmp/modules/400/docker/cil:519
(allow spc_t unlabeled_t (file (entrypoint)))
<root>
allow at /var/lib/selinux/targeted/tmp/modules/100/sandboxX/cil:840
(allow sandbox_x_domain exec_type (file (entrypoint)))
<root>
allow at /var/lib/selinux/targeted/tmp/modules/100/virt/cil:1664
(allow virtd_lxc_t exec_type (file (entrypoint)))
<root>
allow at /var/lib/selinux/targeted/tmp/modules/100/virt/cil:2055
(allow svirt_sandbox_domain exec_type (file (entrypoint)))
Failed to generate binary
/usr/sbin/semodule: Failed!
restorecon: lstat(/var/lib/docker) failed: No such file or directory
警告:%post(docker-engine-selinux-17.05.0.ce-1.fc25.noarch) 脚本执行失败,退出状态码为 255
Non-fatal POSTIN scriptlet failure in rpm package docker-engine-selinux
Non-fatal POSTIN scriptlet failure in rpm package docker-engine-selinux
安装 : docker-engine-17.05.0.ce-1.fc25.x86_64 11/11
运行脚本: docker-engine-17.05.0.ce-1.fc25.x86_64 11/11
验证 : docker-engine-17.05.0.ce-1.fc25.x86_64 1/11
验证 : docker-engine-selinux-17.05.0.ce-1.fc25.noarch 2/11
验证 : libcgroup-0.41-13.fc27.x86_64 3/11
验证 : policycoreutils-python-2.7-1.fc27.x86_64 4/11
验证 : audit-libs-python-2.7.8-1.fc27.x86_64 5/11
验证 : checkpolicy-2.7-1.fc27.x86_64 6/11
验证 : libselinux-python-2.7-2.fc27.x86_64 7/11
验证 : libsemanage-python-2.7-1.fc27.x86_64 8/11
验证 : python2-IPy-0.81-20.fc27.noarch 9/11
验证 : setools-python-4.1.1-3.fc27.x86_64 10/11
验证 : python-enum34-1.1.6-2.fc27.noarch 11/11
已安装:
docker-engine.x86_64 17.05.0.ce-1.fc25 audit-libs-python.x86_64 2.7.8-1.fc27 checkpolicy.x86_64 2.7-1.fc27 docker-engine-selinux.noarch 17.05.0.ce-1.fc25
libcgroup.x86_64 0.41-13.fc27 libselinux-python.x86_64 2.7-2.fc27 libsemanage-python.x86_64 2.7-1.fc27 policycoreutils-python.x86_64 2.7-1.fc27
python-enum34.noarch 1.1.6-2.fc27 python2-IPy.noarch 0.81-20.fc27 setools-python.x86_64 4.1.1-3.fc27
完毕!
启动
systemctl start docker.service
验证
[root@localhost init.d]# docker version
Client:
Version: 17.05.0-ce
API version: 1.29
Go version: go1.7.5
Git commit: 89658be
Built: Thu May 4 22:14:18 2017
OS/Arch: linux/amd64
Server:
Version: 17.05.0-ce
API version: 1.29 (minimum version 1.12)
Go version: go1.7.5
Git commit: 89658be
Built: Thu May 4 22:14:18 2017
OS/Arch: linux/amd64
Experimental: false
有client和service两部分表示docker安装启动都成功了
设置开机启动
[root@localhost init.d]# sudo systemctl enable docker