用其他主机docker login登录Harbor仓库报错
做微服务的时候,我准备把编译好的jar包,部署到我的Harbor仓库上,却登录不上去,出现以下报错:
[root@k8s-master ~]# docker login 192.168.30.24
Username: admin
Password:
Error response from daemon: Get https://192.168.30.24/v2/: dial tcp 192.168.30.24:443: connect: connection refused
这里说拒绝连接,因为我是用http部署的harbor,这里是https://进行访问的,所有出现报错
然后解决这个问题其实就在/etc/docker/daemon.json文件下
添加对私有仓库的认证就可以登录了
[root@k8s-master ~]# vim /etc/docker/daemon.json
{
"registry-mirrors": ["http://f1361db2.m.daocloud.io"],
"insecure-registries": ["192.168.30.24"]
}
重启docker
[root@k8s-master ~]# systemctl restart docker
登录,这里说你已经登陆了,在另一台主机。OK,问题解决
[root@k8s-master ~]# docker login 192.168.30.24
Username: admin
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded