ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

Docker启动报错unable to configure the Docker daemon with file daemon.json:cannot unmarshal s…[]错误解决

2022-01-06 18:04:11  阅读:1017  来源: 互联网

标签:daemon 06 17 service systemd 报错 iZ2ze9d5m6vjfbqzb49i5qZ docker Docker


服务器(CentOS)重启后,发现Docker启动不起来了

[root@iZ2ze9d5m6vjfbqzb49i5qZ ~]# 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查看容器状态

[root@iZ2ze9d5m6vjfbqzb49i5qZ ~]# sudo 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 Thu 2022-01-06 17:29:31 CST; 11s ago
     Docs: http://docs.docker.com
  Process: 2711 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-profile=/etc/docker/seccomp.json $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY $REGISTRIES (code=exited, status=1/FAILURE)
 Main PID: 2711 (code=exited, status=1/FAILURE)

Jan 06 17:29:31 iZ2ze9d5m6vjfbqzb49i5qZ systemd[1]: Starting Docker Application Container Engine...
Jan 06 17:29:31 iZ2ze9d5m6vjfbqzb49i5qZ dockerd-current[2711]: unable to configure the Docker daemon with file /etc/docker/daemon.json: json: cannot unmarshal s...[]string
Jan 06 17:29:31 iZ2ze9d5m6vjfbqzb49i5qZ systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Jan 06 17:29:31 iZ2ze9d5m6vjfbqzb49i5qZ systemd[1]: Failed to start Docker Application Container Engine.
Jan 06 17:29:31 iZ2ze9d5m6vjfbqzb49i5qZ systemd[1]: Unit docker.service entered failed state.
Jan 06 17:29:31 iZ2ze9d5m6vjfbqzb49i5qZ systemd[1]: docker.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

发现关键报错,unable to configure the Docker daemon with file /etc/docker/daemon.json: json: cannot unmarshal s…[]string,但是好像又没有显示全,加上-l参数查看详细信息

[root@iZ2ze9d5m6vjfbqzb49i5qZ ~]# sudo systemctl status docker.service -l
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Thu 2022-01-06 17:34:12 CST; 22s ago
     Docs: http://docs.docker.com
  Process: 2773 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-profile=/etc/docker/seccomp.json $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY $REGISTRIES (code=exited, status=1/FAILURE)
 Main PID: 2773 (code=exited, status=1/FAILURE)

Jan 06 17:34:12 iZ2ze9d5m6vjfbqzb49i5qZ systemd[1]: Starting Docker Application Container Engine...
Jan 06 17:34:12 iZ2ze9d5m6vjfbqzb49i5qZ dockerd-current[2773]: unable to configure the Docker daemon with file /etc/docker/daemon.json: json: cannot unmarshal string into Go struct field Config.registry-mirrors of type []string
Jan 06 17:34:12 iZ2ze9d5m6vjfbqzb49i5qZ systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Jan 06 17:34:12 iZ2ze9d5m6vjfbqzb49i5qZ systemd[1]: Failed to start Docker Application Container Engine.
Jan 06 17:34:12 iZ2ze9d5m6vjfbqzb49i5qZ systemd[1]: Unit docker.service entered failed state.
Jan 06 17:34:12 iZ2ze9d5m6vjfbqzb49i5qZ systemd[1]: docker.service failed.

发现了关键报错信息,我们配置的docker镜像写法错误

unable to configure the Docker daemon with file /etc/docker/daemon.json: json: cannot unmarshal string into Go struct field Config.registry-mirrors of type []string

在这里插入图片描述
于是修改daemon.json配置文件

vi /etc/docker/daemon.json

之前的写法为:

{"registry-mirrors":"https://docker.mirrors.ustc.edu.cn","live-restore":true}

修改后为

{"registry-mirrors":["https://docker.mirrors.ustc.edu.cn"],"live-restore":true}

错误解决
在这里插入图片描述

标签:daemon,06,17,service,systemd,报错,iZ2ze9d5m6vjfbqzb49i5qZ,docker,Docker
来源: https://blog.csdn.net/weixin_42619772/article/details/122349361

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有