在搭建harbor时,客户端需要上传镜像至harbor服务器端,修改配置文件时/usr/lib/systemd/system/docker.service,然后重启docker服务的时候出现报错,通过看日志报错项,下面是报错代码

tail -f /var/log/messages

Mar 29 14:57:32 localhost dockerd: 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: (from flag: [192.168.241.3], from file: [192.168.241.20:5000])

解决思路:
通过日志的报错项提示在/etc/docker/daemon.json这个文件已经规定了一个仓库
1、既然日志提示/etc/docker/daemon.json有问题,那我们就去看下

cat /etc/docker/daemon.json
{
  "insecure-registries":["192.168.241.20:5000"],
  "registry-mirrors": ["https://9it5um2j.mirror.aliyuncs.com"]
}

这里发现这里有一个私有仓库的地址了
2、直接删除私有仓库这行

[root@localhost ~]# cat /etc/docker/daemon.json
{
  "registry-mirrors": ["https://9it5um2j.mirror.aliyuncs.com"]
}

3、再次重启docker服务

systemctl daemon-reload 
systemctl restart docker

问题解决~~~

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐