关于docker启动Job for docker.service failed because the control process exited error code的问题:

网上于有许许多多的解决方案,我经过一下午漫长调试还是不行,基本上是瞎搞不看原因,第二天我仔细对比了以下错误信息才发现,大家的错误原因是不同的,所以有些方法对你有用可是对别人不能用比如:

  1. 第一种错误:

[root@192 etc]# 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@192 etc]# 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 Tue 2019-01-22 06:51:58 EST; 12s ago
Docs: http://docs.docker.com
Process: 8623 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-pro
file=/etc/docker/seccomp.json $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY $REGISTRIES (code=exi
ted, status=1/FAILURE)
Main PID: 8623 (code=exited, status=1/FAILURE)

Jan 22 06:51:57 192.168.0.112 systemd[1]: Starting Docker Application Container Engine…
Jan 22 06:51:57 192.168.0.112 dockerd-current[8623]: time=“2019-01-22T06:51:57.268935143-05:00” level=warning msg=“could not change group /var/run…t found”
Jan 22 06:51:57 192.168.0.112 dockerd-current[8623]: time=“2019-01-22T06:51:57.277320999-05:00” level=info msg=“libcontainerd: new containerd proc…d: 8628”
Jan 22 06:51:58 192.168.0.112 dockerd-current[8623]: time=“2019-01-22T06:51:58.286611873-05:00” level=warning msg="overlay2: the backing xfs filesystem is…
Jan 22 06:51:58 192.168.0.112 dockerd-current[8623]: Error starting daemon: SELinux is not supported with the overlay2 graph driver on this kernel…d=false)
Jan 22 06:51:58 192.168.0.112 systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Jan 22 06:51:58 192.168.0.112 systemd[1]: Failed to start Docker Application Container Engine.
Jan 22 06:51:58 192.168.0.112 systemd[1]: Unit docker.service entered failed state.
Jan 22 06:51:58 192.168.0.112 systemd[1]: docker.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
像这样的错误,我们还是得看仔细了,看错误原因有一行是这样写的:Jan 22 06:51:58 192.168.0.112 dockerd-current[8623]: Error starting daemon: SELinux is not supported with the overlay2 graph driver on this kernel…d=false)显然是SELinux不支持嘛,然后输入命令vi etc/sysconfig/docker然后输入i插入编辑把OPTIONS=’–selinux-disabled,好了有这样问题的小伙伴就可以轻松解决。

  1. 第二种
    ● docker.service - Docker Application Container Engine
    Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
    Active: failed (Result: exit-code) since Mon 2017-07-03 10:12:16 CST; 5s ago
    Docs: http://docs.docker.com
    Process: 16172 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 $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY (code=exited, status=1/FAILURE)
    Main PID: 16172 (code=exited, status=1/FAILURE)

Jul 03 10:12:15 ALY-HKC-PRO-001 systemd[1]: Starting Docker Application Container Engine…
Jul 03 10:12:15 ALY-HKC-PRO-001 dockerd-current[16172]: time=“2017-07-03T10:12:15.812330534+08:00” level=info msg=“libcontainerd: new containerd process, pid: 16180”
Jul 03 10:12:16 ALY-HKC-PRO-001 dockerd-current[16172]: time=“2017-07-03T10:12:16.823237678+08:00” level=warning msg=“devmapper: Usage of loopback devices is strongly discourage…v section.”
Jul 03 10:12:16 ALY-HKC-PRO-001 dockerd-current[16172]: time=“2017-07-03T10:12:16.838204058+08:00” level=error msg="[graphdriver] prior storage driver “devicemapper” failed: d…run failed"
Jul 03 10:12:16 ALY-HKC-PRO-001 dockerd-current[16172]: time=“2017-07-03T10:12:16.838278116+08:00” level=fatal msg=“Error starting daemon: error initializing graphdriver: devmap…run failed”
Jul 03 10:12:16 ALY-HKC-PRO-001 systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Jul 03 10:12:16 ALY-HKC-PRO-001 systemd[1]: Failed to start Docker Application Container Engine.
Jul 03 10:12:16 ALY-HKC-PRO-001 systemd[1]: Unit docker.service entered failed state.
Jul 03 10:12:16 ALY-HKC-PRO-001 systemd[1]: docker.service failed.
**如果你细心的话第二种错误也可以找到如 level=error msg="[graphdriver] prior storage driver “devicemapper” failed: d…run failed"
Jul 03 10:12:16 ALY-HKC-PRO-001 dockerd-current[16172]: time=“2017-07-03T10:12:16.838278116+08:00” level=fatal msg=“Error starting daemon: error initializing graphdriver: devmap…run failed”**查阅网上的解决办法如:vi /etc/docker/daemon.json 然后按i插入编辑
{ “graph”: “/mnt/docker-data”, “storage-driver”: “overlay”}
接着按esc然后ctr+;输入wq保存退出接着输入命令:
rm -rf /var/lib/docker
然后完成。

  1. 第三种
    [root@ip-172-31-8-236 run]# 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 三 2016-10-19 02:58:23 UTC; 20s ago
    Docs: http://docs.docker.com
    Process: 10835 ExecStart=/usr/bin/docker-current daemon --exec-opt native.cgroupdriver=systemd $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY (code=exited, status=1/FAILURE)
    Main PID: 10835 (code=exited, status=1/FAILURE)

10月 19 02:58:23 ip-172-31-8-236.cn-north-1.compute.internal systemd[1]: Starting Docker Application Container Engine…
10月 19 02:58:23 ip-172-31-8-236.cn-north-1.compute.internal docker-current[10835]: time=“2016-10-19T02:58:23.880006578Z” level=fatal msg=“can’t create unix socket /var/run/docker.sock: is a directory”
10月 19 02:58:23 ip-172-31-8-236.cn-north-1.compute.internal systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
10月 19 02:58:23 ip-172-31-8-236.cn-north-1.compute.internal systemd[1]: Failed to start Docker Application Container Engine.
10月 19 02:58:23 ip-172-31-8-236.cn-north-1.compute.internal systemd[1]: Unit docker.service entered failed state.
**貌似这种比较老的版本,现在基本上没有出现这中10月 19 02:58:23 ip-172-31-8-236.cn-north-1.compute.internal docker-current[10835]: time=“2016-10-19T02:58:23.880006578Z” level=fatal msg=“can’t create unix socket /var/run/docker.sock: is a directory”**解决过程:
删除docker.sock目录,
service docker start 启动docker服务
启动过程好像出现了长时间的阻塞,后不得已强制结束,Ctrl+c
查看/var/run/目录下已新建了docker.sock文件
查看docker服务是否启动:docker image
还是出现阻塞
service docker stop 关闭docker服务,好似正常关闭
然后service docker start启动docker服务,正常启动!
原文:https://blog.csdn.net/u012891504/article/details/52857682

4.第四种
[root@master01 ~]# systemctl restart 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@master01 ~]# 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 Mon 2018-01-22 23:31:10 CST; 5s ago
Docs: http://docs.docker.com
Process: 17943 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 $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY $REGISTRIES (code=exited, status=1/FAILURE)
Main PID: 17943 (code=exited, status=1/FAILURE)

Jan 22 23:31:09 master01 systemd[1]: Starting Docker Application Container Engine…
Jan 22 23:31:09 master01 dockerd-current[17943]: time=“2018-01-22T23:31:09.315315148+08:00” level=info msg=“libcontainerd: new containerd process, pid: 17954”
Jan 22 23:31:10 master01 dockerd-current[17943]: time=“2018-01-22T23:31:10.329514525+08:00” level=fatal msg=“Error starting daemon: error initializing graphdriver: devmapper…_devices\n”
Jan 22 23:31:10 master01 systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Jan 22 23:31:10 master01 systemd[1]: Failed to start Docker Application Container Engine.
Jan 22 23:31:10 master01 systemd[1]: Unit docker.service entered failed state.
Jan 22 23:31:10 master01 systemd[1]: docker.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
原因**22T23:31:10.329514525+08:00" level=fatal msg=“Error starting daemon: error initializing graphdriver: devmapper…_devices\n”**解决方式
处理方法
vim /etc/sysconfig/docker-storage
DOCKER_STORAGE_OPTIONS=
vim /etc/sysconfig/docker
OPTIONS=’–selinux-enabled --log-driver=journald --signature-verification=false’

vim /etc/docker/daemon.json

{ “storage-driver”: “devicemapper” }
最后重启docker
[root@master01 ~]# systemctl restart docker
原文:https://blog.csdn.net/liu9718214/article/details/79134900

  1. 第五种
    ● docker.service - Docker Application Container Engine
    Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
    Active: failed (Result: exit-code) since Tue 2019-01-22 07:00:14 EST; 6s ago
    Docs: http://docs.docker.com
    Process: 8770 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-pro
    file=/etc/docker/seccomp.json $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY $REGISTRIES (code=exi
    ted, status=1/FAILURE)
    Main PID: 8770 (code=exited, status=1/FAILURE)

Jan 22 07:00:14 192.168.0.112 dockerd-current[8770]: --userland-proxy Use userland proxy for loopback traffic (default true)
Jan 22 07:00:14 192.168.0.112 dockerd-current[8770]: --userland-proxy-path string Path to the userland proxy binary
Jan 22 07:00:14 192.168.0.112 dockerd-current[8770]: --userns-remap string User/Group setting for user namespaces
Jan 22 07:00:14 192.168.0.112 dockerd-current[8770]: -v, --version Print version information and quit
Jan 22 07:00:14 192.168.0.112 dockerd-current[8770]: Run ‘dockerd COMMAND --help’ for more information on a command.
Jan 22 07:00:14 192.168.0.112 dockerd-current[8770]: , Code: 125
Jan 22 07:00:14 192.168.0.112 systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Jan 22 07:00:14 192.168.0.112 systemd[1]: Failed to start Docker Application Container Engine.
Jan 22 07:00:14 192.168.0.112 systemd[1]: Unit docker.service entered failed state.
Jan 22 07:00:14 192.168.0.112 systemd[1]: docker.service failed.
这个也是我遇到第一个错误后遇到的第二个错误,悲催,
怎么呢,我是直接按照https://my.oschina.net/u/3574106/blog/1860342来的,按照它的来一下就好了。

还有其他原因我就不一一列举了。
希望自己以后看错误要细心,不能看到全英文就放弃,仔细看都能看懂。不能瞎搞一起,胡乱搞下次出现这种错误你还是不能够搞对。

Logo

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

更多推荐