docker服务无法启动的解决方法

一直使用的好好的docker,突然不能启动了

报如下错误

 

 

root@ubuntu-s-2vcpu-4gb-sgp1-01:~# service docker start
Job for docker.service failed because the control process exited with error code                                                                                                 . See "systemctl status docker.service" and "journalctl -xe" for details.
root@ubuntu-s-2vcpu-4gb-sgp1-01:~# journalctl -xe
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:3
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:3
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:3
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:3
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:3
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:3
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:3
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:3
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:3
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:3
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:3
May 18 07:39:40 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: Error starting daemon
May 18 07:39:40 ubuntu-s-2vcpu-4gb-sgp1-01 systemd[1]: docker.service: Main proc
May 18 07:39:40 ubuntu-s-2vcpu-4gb-sgp1-01 systemd[1]: Failed to start Docker Ap
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has failed.
--
-- The result is failed.
May 18 07:39:40 ubuntu-s-2vcpu-4gb-sgp1-01 systemd[1]: docker.service: Unit ente
May 18 07:39:40 ubuntu-s-2vcpu-4gb-sgp1-01 systemd[1]: docker.service: Failed wi
lines 1321-1343/1343 (END)
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:39:39.620
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:39:39.620
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:39:39.620
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:39:39.620
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:39:39.621
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:39:39.633
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:39:39.633
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:39:39.636
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:39:39.636
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:39:39.638
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:39:39.638
May 18 07:39:40 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: Error starting daemon: error
May 18 07:39:40 ubuntu-s-2vcpu-4gb-sgp1-01 systemd[1]: docker.service: Main process exit
May 18 07:39:40 ubuntu-s-2vcpu-4gb-sgp1-01 systemd[1]: Failed to start Docker Applicatio
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has failed.
--
-- The result is failed.
May 18 07:39:40 ubuntu-s-2vcpu-4gb-sgp1-01 systemd[1]: docker.service: Unit entered fail
May 18 07:39:40 ubuntu-s-2vcpu-4gb-sgp1-01 systemd[1]: docker.service: Failed with resul
~
~
~
~
lines 1321-1343/1343 (END)
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:39:39.620209592Z"
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:39:39.620691025Z"
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:39:39.620748517Z"
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:39:39.620890172Z"
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:39:39.621209567Z"
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:39:39.633035655Z"
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:39:39.633813805Z"
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:39:39.636067581Z"
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:39:39.636097409Z"
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:39:39.638087200Z"
May 18 07:39:39 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: time="2019-05-18T07:39:39.638898530Z"
May 18 07:39:40 ubuntu-s-2vcpu-4gb-sgp1-01 dockerd[16368]: Error starting daemon: error initializ
May 18 07:39:40 ubuntu-s-2vcpu-4gb-sgp1-01 systemd[1]: docker.service: Main process exited, code=
May 18 07:39:40 ubuntu-s-2vcpu-4gb-sgp1-01 systemd[1]: Failed to start Docker Application Contain
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has failed.
--
-- The result is failed.
May 18 07:39:40 ubuntu-s-2vcpu-4gb-sgp1-01 systemd[1]: docker.service: Unit entered failed state.
May 18 07:39:40 ubuntu-s-2vcpu-4gb-sgp1-01 systemd[1]: docker.service: Failed with result 'exit-c
 

解决方法

查看文件系统 /etc/docker/daemon.json 有没有这个文件,没有则创建目录及文件

在daemon.json文件中输入以下内容:

{ "storage-driver" : "devicemapper" }

如果daemon.json 文件不存在包含格式不正确的JSON, Docker将无法启动 。

具体操作如下:

root@ubuntu-s-2vcpu-4gb-sgp1-01:~# cd /etc/docker/
root@ubuntu-s-2vcpu-4gb-sgp1-01:/etc/docker# ls
key.json
root@ubuntu-s-2vcpu-4gb-sgp1-01:/etc/docker# vi daemon.json
root@ubuntu-s-2vcpu-4gb-sgp1-01:/etc/docker# ll
total 16
drwxr-xr-x   2 root root 4096 May 18 07:44 ./
drwxr-xr-x 108 root root 4096 May 16 03:45 ../
-rw-r--r--   1 root root   38 May 18 07:44 daemon.json
-rw-------   1 root root  244 Mar  5  2018 key.json
root@ubuntu-s-2vcpu-4gb-sgp1-01:/etc/docker# cat daemon.json
{
"storage-driver"
:
"devicemapper"
}
root@ubuntu-s-2vcpu-4gb-sgp1-01:/etc/docker# service docker start
root@ubuntu-s-2vcpu-4gb-sgp1-01:/etc/docker# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                                                                                              PORTS               NAMES
 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值