对于CentOS下启动Docker报如下错误:
[root@dmp-dn docker]# 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@dmp-dn docker]# systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/docker.service.d
└─flannel.conf
Active: failed (Result: exit-code) since Mon 2018-12-03 17:21:35 CST; 11s ago
Docs: http://docs.docker.com
Process: 188654 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: 188654 (code=exited, status=1/FAILURE)
Dec 03 17:21:33 dmp-dn systemd[1]: Starting Docker Application Container Engine...
Dec 03 17:21:33 dmp-dn dockerd-current[188654]: time="2018-12-03T17:21:33.895143142+08:00" lev...nd"
Dec 03 17:21:33 dmp-dn dockerd-current[188654]: time="2018-12-03T17:21:33.898318740+08:00" lev...68"
Dec 03 17:21:34 dmp-dn dockerd-current[188654]: time="2018-12-03T17:21:34.910302442+08:00" level=...
Dec 03 17:21:35 dmp-dn dockerd-current[188654]: Error starting daemon: SELinux is not supporte...se)
Dec 03 17:21:35 dmp-dn systemd[1]: docker.service: main process exited, code=exited, status=1...LURE
Dec 03 17:21:35 dmp-dn systemd[1]: Failed to start Docker Application Container Engine.
Dec 03 17:21:35 dmp-dn systemd[1]: Unit docker.service entered failed state.
Dec 03 17:21:35 dmp-dn systemd[1]: docker.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
解决的办法就是修改配置文件/etc/sysconfig/docker中SELinux的配置:
OPTIONS='--selinux-enabled=false --log-driver=journald --signature-verification=false'
if [ -z "${DOCKER_CERT_PATH}" ]; then
DOCKER_CERT_PATH=/etc/docker
fi
错误的原因就是此linux的内核中的SELinux不支持 overlay2 graph driver,我们只需要在docker的配置中禁用selinux即可。
如有问题请加QQ群相互讨论,QQ群号:526855734