When doing microservices, I was about to deploy the compiled jar package to my Harbor repository, but I couldn’t log in, and the following error was reported.
[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
Here it says connection refused, because I am using http deployment of harbor, here is https://进行访问的, all appear to report an error
Then the solution to this problem is actually in the /etc/docker/daemon.json file
Add the authentication to the private repository and you can login
[root@k8s-master ~]# vim /etc/docker/daemon.json
{
“registry-mirrors”: [“http://f1361db2.m.daocloud.io”],
“insecure-registries”: [“192.168.30.24”]
}
Restart docker
[root@k8s-master ~]# systemctl restart docker
Login, it says you are already logged in, on another host. ok, problem solved
[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