解决方法:

前提是你配置的Harbor支持http。

[#zeyu#]

1、执行:
find / -name docker.service -type f

2、vi /usr/lib/systemd/system/docker.service

#查找:ExecStart=/usr/bin/dockerd 在其后面添加 --insecure-registry=192.168.2.195 配置


#添加后变成:

ExecStart=/usr/bin/dockerd --insecure-registry=192.168.2.195


#这个IP根据你的Harbor的服务器IP来改变。

3、执行:systemctl daemon-reload

4、执行:systemctl restart docker

这个时候,就可以了。


以上操作执行步骤如下:


[root@localhost bin]# find / -name docker.service -type f
/usr/lib/systemd/system/docker.service
[root@localhost bin]# vi /usr/lib/systemd/system/docker.service
[root@localhost bin]# systemctl daemon-reload
[root@localhost bin]# systemctl restart docker
[root@localhost bin]# docker login 192.168.0.7

[/#zeyu#]