在centos7上面在线安装完毕docker启动的使用有时候经常碰到如下问题:

[root@localhost ~]# service docker restart
Redirecting to /bin/systemctl restart docker.service
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 Wed 2018-10-31 16:36:08 CST; 33s ago
Docs: http://docs.docker.com
Process: 3170 ExecStart=/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 $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY $REGISTRIES (code=exited, status=1/FAILURE)
Main PID: 3170 (code=exited, status=1/FAILURE)

Oct 31 16:36:06 localhost.localdomain systemd[1]: Starting Docker Application Container Engine...
Oct 31 16:36:06 localhost.localdomain dockerd-current[3170]: time="2018-10-31T16:36:06.856584604+08:00" level=warning msg="could not ...found"
Oct 31 16:36:06 localhost.localdomain dockerd-current[3170]: time="2018-10-31T16:36:06.863620189+08:00" level=info msg="libcontainerd... 3188"
Oct 31 16:36:08 localhost.localdomain dockerd-current[3170]: Error starting daemon: SELinux is not supported with the overlay2 graph ...false)
Oct 31 16:36:08 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Oct 31 16:36:08 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
Oct 31 16:36:08 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
Oct 31 16:36:08 localhost.localdomain systemd[1]: docker.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

在提示日志中看这句“Error starting daemon: SELinux is not supported with the overlay2 graph ...false”,这说明没有配置好docker配置文件,此linux的内核中的SELinux不支持 overlay2 graph driver,直接修改/etc/sysconfig/docker文件里面的配置信息就可以

[root@localhost ~]#vim /etc/sysconfig/docker

# /etc/sysconfig/docker

# Modify these options if you want to change the way the docker daemon runs
OPTIONS='--selinux-enabled=false --log-driver=journald --signature-verification=false'
if [ -z "${DOCKER_CERT_PATH}" ]; then
    DOCKER_CERT_PATH=/etc/docker
fi

注意:

1.默认--selinux-enabled是没有赋值的,此时修改为--selinux-enabled=false,现在重启docker就不会在报错了

2.docker启动出现错误应该首先检查防火墙关闭了没有,selinux关闭了没有