文章 47
评论 19
浏览 59443
docker启动失败故障排查

docker启动失败故障排查

最近阿里云老是发消息说我的服务器有漏洞,今天周末抽时间把服务器漏洞修复一下,按照阿里云提示修复完了重启,然后docker居然启动不起来...

  • 问题:
root@iZwz9ezkmfgg9pbiz2jyc6Z:~# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2020-04-11 17:10:56 CST; 1h 2min ago
     Docs: https://docs.docker.com
  Process: 2176 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
 Main PID: 2176 (code=exited, status=1/FAILURE)

Apr 11 17:10:54 iZwz9ezkmfgg9pbiz2jyc6Z systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Apr 11 17:10:54 iZwz9ezkmfgg9pbiz2jyc6Z systemd[1]: docker.service: Failed with result 'exit-code'.
Apr 11 17:10:54 iZwz9ezkmfgg9pbiz2jyc6Z systemd[1]: Failed to start Docker Application Container Engine.
Apr 11 17:10:56 iZwz9ezkmfgg9pbiz2jyc6Z systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Apr 11 17:10:56 iZwz9ezkmfgg9pbiz2jyc6Z systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
Apr 11 17:10:56 iZwz9ezkmfgg9pbiz2jyc6Z systemd[1]: Stopped Docker Application Container Engine.
Apr 11 17:10:56 iZwz9ezkmfgg9pbiz2jyc6Z systemd[1]: docker.service: Start request repeated too quickly.
Apr 11 17:10:56 iZwz9ezkmfgg9pbiz2jyc6Z systemd[1]: docker.service: Failed with result 'exit-code'.
Apr 11 17:10:56 iZwz9ezkmfgg9pbiz2jyc6Z systemd[1]: Failed to start Docker Application Container Engine.
  • 光看这个貌似没有什么解决方案,那么直接启动看看是啥问题:
root@iZwz9ezkmfgg9pbiz2jyc6Z:~# 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@iZwz9ezkmfgg9pbiz2jyc6Z:~# dockerd
unable to configure the Docker daemon with file /etc/docker/daemon.json: unexpected EOF
  • 到此问题大概浮现出来了,配置文件/etc/docker/daemon.json貌似问题很大,于是打开看看
root@iZwz9ezkmfgg9pbiz2jyc6Z:/etc/docker# cat daemon.json 
{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"]

json少了一个花括弧,加上吧,然后启动,正常了!

  • 总结一下:
    docker启动如果看不到问题,可以使用dockerd日志模式启动,可以发现问题!

哈哈哈哈哈哈哈嗝~

取消