Docker启动失败求助:--registry-mirror参数配置错误排查
Docker启动失败排查与解决
问题现象
执行systemctl start docker时启动失败,提示控制进程退出并返回错误码。排查systemctl status docker.service和journalctl -xe后发现,问题源于--registry-mirror参数配置无效,且找不到该参数的修改位置。已尝试重装Docker、删除daemon.json文件,问题仍未解决。
环境版本
- Docker版本:
Docker version 24.0.0-beta.1, build 33961a7 - Linux内核版本:
Linux localhost.localdomain 3.10.0-1160.88.1.el7.x86_64 #1 SMP Tue Mar 7 15:41:52 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux - CentOS版本:
CentOS Linux release 7.9.2009 (Core)
错误日志
启动命令报错
[root@localhost docker]# 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.
systemctl status docker.service输出
● docker.service - Docker Application Container Engine Loaded: loaded (/etc/systemd/system/docker.service; disabled; vendor preset: disabled) Active: failed (Result: start-limit) since Sun 2023-04-02 01:34:47 CEST; 5min ago Docs: https://docs.docker.com Process: 9060 ExecStart=/usr/bin/dockerd --registry-mirror=<your accelerate address> -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE) Main PID: 9060 (code=exited, status=1/FAILURE) Apr 02 01:34:44 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine. Apr 02 01:34:44 localhost.localdomain systemd[1]: Unit docker.service entered failed state. Apr 02 01:34:44 localhost.localdomain systemd[1]: docker.service failed. Apr 02 01:34:47 localhost.localdomain systemd[1]: docker.service holdoff time over, scheduling restart. Apr 02 01:34:47 localhost.localdomain systemd[1]: Stopped Docker Application Container Engine. Apr 02 01:34:47 localhost.localdomain systemd[1]: start request repeated too quickly for docker.service Apr 02 01:34:47 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine. Apr 02 01:34:47 localhost.localdomain systemd[1]: Unit docker.service entered failed state. Apr 02 01:34:47 localhost.localdomain systemd[1]: docker.service failed.
journalctl -xe输出
Apr 02 01:34:42 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE Apr 02 01:34:42 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine. -- 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. Apr 02 01:34:42 localhost.localdomain systemd[1]: Unit docker.service entered failed state. Apr 02 01:34:42 localhost.localdomain systemd[1]: docker.service failed. Apr 02 01:34:44 localhost.localdomain systemd[1]: docker.service holdoff time over, scheduling restart. Apr 02 01:34:44 localhost.localdomain systemd[1]: Stopped Docker Application Container Engine. -- Subject: Unit docker.service has finished shutting down -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit docker.service has finished shutting down. Apr 02 01:34:44 localhost.localdomain systemd[1]: Starting Docker Application Container Engine... -- Subject: Unit docker.service has begun start-up -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit docker.service has begun starting up. Apr 02 01:34:44 localhost.localdomain dockerd[9060]: Status: invalid argument "<your" for "--registry-mirror" flag: invalid mirror: unsupported scheme "" in "%3Cyour" Apr 02 01:34:44 localhost.localdomain dockerd[9060]: See 'dockerd --help'., Code: 125 Apr 02 01:34:44 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE Apr 02 01:34:44 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine. -- 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. Apr 02 01:34:44 localhost.localdomain systemd[1]: Unit docker.service entered failed state. Apr 02 01:34:44 localhost.localdomain systemd[1]: docker.service failed. Apr 02 01:34:47 localhost.localdomain systemd[1]: docker.service holdoff time over, scheduling restart. Apr 02 01:34:47 localhost.localdomain systemd[1]: Stopped Docker Application Container Engine. -- Subject: Unit docker.service has finished shutting down -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit docker.service has finished shutting down. Apr 02 01:34:47 localhost.localdomain systemd[1]: start request repeated too quickly for docker.service Apr 02 01:34:47 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine. -- 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. Apr 02 01:34:47 localhost.localdomain systemd[1]: Unit docker.service entered failed state. Apr 02 01:34:47 localhost.localdomain systemd[1]: docker.service failed. lines 2500-2554/2554 (END)
解决步骤
- 编辑Docker的systemd服务文件:
vi /etc/systemd/system/docker.service - 找到
ExecStart行,删除--registry-mirror=<your accelerate address>占位符内容,或者替换为实际的镜像加速地址(格式示例:https://xxxx.mirror.aliyuncs.com)。 - 重新加载systemd配置:
systemctl daemon-reload - 启动Docker服务:
systemctl start docker - 验证服务状态:
systemctl status docker
内容的提问来源于stack exchange,提问作者Dylan Windler
相关产品推荐
相关产品推荐

