启动docker时报错2:Job for docker.service Job for docker.service failed because the co

193 阅读2分钟
#docker启动失败
[root@localhost ~]# systemctl start docker
Job for docker.service failed because the control process exited with error code. See "syste
mctl status docker.service" and "journalctl -xe" for details.

#查看错误信息
[root@localhost ~]# systemctl status docker.service -l
● 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 2019-06-19 04:25:25 EDT; 14min ago
     Docs: http://docs.docker.com
  Process: 5412 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_O
PTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY $REGISTRIES (code=exited, status=1/FAILURE)
 Main PID: 5412 (code=exited, status=1/FAILURE)

Jun 19 04:25:24 localhost.localdomain systemd[1]: Starting Docker Application Container Engine...
Jun 19 04:25:24 localhost.localdomain dockerd-current[5412]: time="2019-06-19T04:25:24.402861259-04:00" level=warning msg="could not change group /var/run/docker.sock to docker: group docker not fo
und"
Jun 19 04:25:24 localhost.localdomain dockerd-current[5412]: time="2019-06-19T04:25:24.418276049-04:00" level=info msg="libcontainerd: new containerd process, pid: 5417"
Jun 19 04:25:25 localhost.localdomain dockerd-current[5412]: time="2019-06-19T04:25:25.440697173-04:00" level=warning msg="overlay2: the backing xfs filesystem is formatted without d_type support,
which leads to incorrect behavior. Reformat the filesystem with ftype=1 to enable d_type support. Running without d_type support will no longer be supported in Docker 1.16."
Jun 19 04:25:25 localhost.localdomain dockerd-current[5412]: Error starting daemon: SELinux is not supported with the overlay2 graph driver on this kernel. Either boot into a newer kernel or disabl
e selinux in docker (--selinux-enabled=false)
Jun 19 04:25:25 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Jun 19 04:25:25 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
Jun 19 04:25:25 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
Jun 19 04:25:25 localhost.localdomain systemd[1]: docker.service failed.

问题原因:

linux的内核中的SELinux不支持 overlay2 graph driver

解决办法:

可以在docker里禁用selinux,设置参数?Cselinux-enabled=false
#编辑
vi /etc/sysconfig/docker
#修改
OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false'
OPTIONS='--selinux-enabled=false --log-driver=journald --signature-verification=false'
#重启
systemctl start docker