在启动Docker时出现以下问题:

Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

然后根据提示进行systemctl status docker.service,打印出相关的日志:

[root@localhost ~]# systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2018-04-27 21:25:13 EDT; 3min 32s ago
     Docs: http://docs.docker.com
  Process: 2390 ExecStart=/usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=dock
er-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --seccomp-profile=/etc/docker
/seccomp.json $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY $REGISTRIES (code=e
xited, status=1/FAILURE)
 Main PID: 2390 (code=exited, status=1/FAILURE)

Apr 27 21:25:12 localhost.localdomain systemd[1]: Starting Docker Application Container Engine...
Apr 27 21:25:12 localhost.localdomain dockerd-current[2390]: time="2018-04-27T21:25:12.286650644-04:00" level=warning msg="could no...ound"
Apr 27 21:25:12 localhost.localdomain dockerd-current[2390]: time="2018-04-27T21:25:12.295209148-04:00" level=info msg="libcontaine...2395"
Apr 27 21:25:13 localhost.localdomain dockerd-current[2390]: time="2018-04-27T21:25:13.310268309-04:00" level=warning msg="overlay2: the...
Apr 27 21:25:13 localhost.localdomain dockerd-current[2390]: Error starting daemon: SELinux is not supported with the overlay2 grap...alse)
Apr 27 21:25:13 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Apr 27 21:25:13 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
Apr 27 21:25:13 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
Apr 27 21:25:13 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 grap...alse

这是由于overlay2不支持造成的,所以我们要关闭它。

可以进行以下配置:

重新编辑docker配置文件:
vi /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

:wq 

然后进行重启操作:

systemctl  restart  docker

然后在进行查看Docker状态,便可以看到以下信息:

[root@localhost ~]# systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2018-04-27 21:48:13 EDT; 53s ago
     Docs: http://docs.docker.com
 Main PID: 16413 (dockerd-current)
   CGroup: /system.slice/docker.service
           ├─16413 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-r...
           └─16418 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=...

Apr 27 21:48:12 localhost.localdomain dockerd-current[16413]: time="2018-04-27T21:48:12.000737232-04:00" level=info msg="Firewalld ...alse"
Apr 27 21:48:12 localhost.localdomain dockerd-current[16413]: time="2018-04-27T21:48:12.764995975-04:00" level=info msg="Default br...ress"
Apr 27 21:48:13 localhost.localdomain dockerd-current[16413]: time="2018-04-27T21:48:13.150510699-04:00" level=info msg="Loading co...one."
Apr 27 21:48:13 localhost.localdomain dockerd-current[16413]: time="2018-04-27T21:48:13.156621343-04:00" level=warning msg="Not usi... fix"
Apr 27 21:48:13 localhost.localdomain dockerd-current[16413]: time="2018-04-27T21:48:13.331900430-04:00" level=warning msg="failed ...ev\n"
Apr 27 21:48:13 localhost.localdomain dockerd-current[16413]: time="2018-04-27T21:48:13.332005350-04:00" level=warning msg="failed ...sion"
Apr 27 21:48:13 localhost.localdomain dockerd-current[16413]: time="2018-04-27T21:48:13.333707951-04:00" level=info msg="Daemon has...tion"
Apr 27 21:48:13 localhost.localdomain dockerd-current[16413]: time="2018-04-27T21:48:13.333744475-04:00" level=info msg="Docker dae....13.1
Apr 27 21:48:13 localhost.localdomain systemd[1]: Started Docker Application Container Engine.
Apr 27 21:48:13 localhost.localdomain dockerd-current[16413]: time="2018-04-27T21:48:13.393668741-04:00" level=info msg="API listen...sock"
Hint: Some lines were ellipsized, use -l to show in full.
自此,Docker启动成功!!希望对遇到和我一样的坑的朋友有点帮助!!!
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐