docker 不能启动问题:“unable to configure the Docker daemon with file...“

背景:

为了让docker可以访问局域网镜像仓库,在/etc/docker/daemon.json增加了insecure-registries记录。

问题:

使用systemctl restart docker.service命令启动docker,发现启动失败,通过systemctl status docker.service命令查看到如下错误:

unable to configure the Docker daemon with file /etc/docker/daemon.json: the following directives are specified both as a flag and in the configuration file: insecure-registries 

原因:

通过systemctl status docker.service看到, docker service 的配置文件是/usr/lib/systemd/system/docker.service,而里面的ExecStart命令中包含有多个--insecure-registry参数。 应该是不能同时在启动命令和daemon.json配置中设置insecure-registry参数。

解决:

方式1:删除/etc/docker/daemon.json  的 insecure-registries设置。将需要添加的镜像仓库IP地址加到启动命令中。测试通过。

方式2:在docker service 配置文件中,删除ExecStart 中的--insecure-registry参数,统一在/etc/docker/daemon.json中配置。未验证。

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值