修改镜像配置后 启动docker失败

背景

systemctl start docker失败,输出如下:

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

分析

根据输出,可以执行systemctl status docker或者journalctl -xeu docker.service来分析报错。

首先执行systemctl status docker,输出如下:

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 Thu 2023-04-27 03:53:32 UTC; 2h 18min ago
TriggeredBy: × docker.socket
       Docs: https://docs.docker.com
    Process: 1820 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
   Main PID: 1820 (code=exited, status=1/FAILURE)
        CPU: 89ms

Apr 27 03:53:32 xxx systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
Apr 27 03:53:32 xxx systemd[1]: Stopped Docker Application Container Engine.
Apr 27 03:53:32 xxx systemd[1]: docker.service: Start request repeated too quickly.
Apr 27 03:53:32 xxx systemd[1]: docker.service: Failed with result 'exit-code'.
Apr 27 03:53:32 xxx systemd[1]: Failed to start Docker Application Container Engine.
Apr 27 03:53:59 xxx systemd[1]: docker.service: Start request repeated too quickly.
Apr 27 03:53:59 xxx systemd[1]: docker.service: Failed with result 'exit-code'.
Apr 27 03:53:59 xxx systemd[1]: Failed to start Docker Application Container Engine

没找到什么有用的信息,只知道它重启了很多次。

然后执行journalctl -xeu docker.service,输出如下:

Apr 27 06:12:05 xxx dockerd[2055]: unable to configure the Docker daemon with file /etc/docker/daemon.json: invalid character 'â' after top-level value
Apr 27 06:12:05 xxx systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ An ExecStart= process belonging to unit docker.service has exited.
░░ 
░░ The process' exit code is 'exited' and its exit status is 1.
Apr 27 06:12:05 xxx systemd[1]: docker.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ The unit docker.service has entered the 'failed' state with result 'exit-code'.
Apr 27 06:12:05 xxx systemd[1]: Failed to start Docker Application Container Engine.
░░ Subject: A start job for unit docker.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ A start job for unit docker.service has finished with a failure.
░░ 
░░ The job identifier is 3097 and the job result is failed.
Apr 27 06:12:08 xxx systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
░░ Subject: Automatic restarting of a unit has been scheduled
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ Automatic restarting of the unit docker.service has been scheduled, as the result for
░░ the configured Restart= setting for the unit.
Apr 27 06:12:08 xxx systemd[1]: Stopped Docker Application Container Engine.

我们发现,是配置文件daemon.json中有非法字符:

invalid character ‘â’ after top-level value

我们把配置内容复制到本地编辑器,检查并清理下内容,再拷贝到服务器上。

然后执行

dos2unix daemon.json

把回车键清理一下

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值