Linux centos7下安装docker需要 linux 内核在 3.10.0 以上, 查看内核的方法为:
# 查看版本号
[root@localhost sysconfig]# uname -r
3.10.0-327.el7.x86_64
然后使用安装命令:
[root@localhost ~]# yum install docker
途中会遇到输入 y/n ,直接输入y继续就行了,直到出现 ‘Complete!’ 表示安装完成。
使用 docker -v 查看docker版本:
[root@localhost ~]# docker -v
Docker version 1.13.1, build 07f3374/1.13.1
出现版本号则表示安装成功,可以启动docker了,启动命令为:
[root@localhost /]# systemctl start docker
启动命令执行后若没有输出则表示启动成功。
注意: 经常会启动的时候报如下错误信息:
Job for docker.service failed because the control process exited with error code.
See \"systemctl status docker.service\" and \"journalctl -xe\" for details.
使用上面提供的命令查看状态:
[root@localhost ~]# systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled
)
Active: failed (Result: exit-code) since Sat 2018-12-15 02:57:20 EST; 38s ago
Docs: http://docs.docker.com
Process: 4955 ExecStart=/usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/do
cker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=system
d --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --init-path=/usr/libexec/do
cker/docker-init-current --seccomp-profile=/etc/docker/seccomp.json $OPTIONS $DOCKER_STORAGE
_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY $REGISTRIE
S (code=exited, status=1/FAILURE)
解决方法:
将下面的OPTIONS选项的 --selinux-enabled 改为 --selinux-enabled=false就可以了
[root@localhost ~]# cd /etc/sysconfig
[root@localhost ~]# vi docker
# /etc/sysconfig/docker
# Modify these options if you want to change the way the docker daemon runs
# 将下面的OPTIONS选项的 --selinux-enabled 改为 --selinux-enabled=false就可以了
OPTIONS =\'--selinux-enabled=false --log-driver=journald --signature-verification=false\'
if [ -z \"${DOCKER_CERT_PATH}\" ]; then
DOCKER_CERT_PATH=/etc/docker
fi
# Do not add registries in this file anymore. Use /etc/containers/registries.conf
# instead. For more information reference the registries.conf(5) man page.
# Location used for temporary files, such as those created by
# docker load and build operations. Default is /var/lib/docker/tmp
# Can be overriden by setting the following environment variable.
# DOCKER_TMPDIR=/var/tmp
# Controls the /etc/cron.daily/docker-logrotate cron job status.
# To disable, uncomment the line below.
# LOGROTATE=false
# docker-latest daemon can be used by starting the docker-latest unitfile.
# To use docker-latest client, uncomment below lines
\"docker\" 26L, 1101C 继续阅读与本文标签相同的文章
上一篇 :
腾讯安全副总裁黎巍:面对挑战,云安全需要共建共治
下一篇 :
浅谈APP应用实现转化成交的四大重要举措
-
1.98亿滴滴用户添加了紧急联系人 每天百万个订单行程分享给亲友
2026-05-14栏目: 教程
-
工程院院士刘韵洁:5G前景很大,但主要是行业应用
2026-05-14栏目: 教程
-
陆奇:看好5G技术,但应用好5G还需要时间
2026-05-14栏目: 教程
-
在Visual Studio中使用clang-tidy进行代码分析
2026-05-14栏目: 教程
-
甘薇贾跃亭曝出离婚消息,贾跃亭破产前转账51万美元,作为“家庭费用”
2026-05-14栏目: 教程
