docker login报错1:
客户端登录:
[root@client ~]# docker login -u admin -p harbor123456 192.168.102.73
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: Get https://192.168.31.10/v2/: x509: certificate signed by unknown authority
以上出现报错,解决办法:
此种情况多发生在自签名的证书,报错含义是签发证书机构未经认证,无法识别。
解决办法(要替换自己证书的路径目录):
[root@localhost harbor]# chmod 644 /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
[root@localhost harbor]# cat /etc/docker/cert/192.168.102.73.crt >> /etc/pki/tls/certs/ca-bundle.crt
[root@localhost harbor]# chmod 444 /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
由于证书是docker的daemon需要用到的,所以需要重启docker服务,进而也要重启docker-compose
[root@localhost harbor]# systemctl daemon-reload
[root@localhost harbor]# systemctl restart docker
[root@localhost harbor]# docker-compose down -v
Stopping harbor-log ... done
Removing nginx ... done
Removing harbor-jobservice ... done
Removing harbor-core ... done
Removing harbor-portal ... done
Removing redis ... done
Removing registry ... done
Removing registryctl ... done
Removing harbor-db ... done
Removing harbor-log ... done
Removing network harbor_harbor
[root@localhost harbor]# docker-compose up -d
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating registry ... done
Creating registryctl ... done
Creating harbor-db ... done
Creating harbor-portal ... done
Creating redis ... done
Creating harbor-core ... done
Creating harbor-jobservice ... done
Creating nginx ... done
然后再次尝试在harbor本机登陆, 发现就可以正常登陆了!!
[root@localhost harbor]# docker login -u admin -p harbor123456 192.168.102.73
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
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
参考原文链接:https://blog.youkuaiyun.com/youmatterhsp/article/details/105868624
docker login报错2:
[root@k8s-node3 harbor]# docker login -u admin -p Harbor12345 192.168.102.73
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: Get "https://192.168.102.73/v2/": Get "https://harbor.mes.com:8082/service/token?account=admin&client_id=docker&offline_token=true&service=harbor-registry": dial tcp 192.168.102.73:8082: connect: connection refused
解决办法:
vim harbor.yml
# external_url: https://harbor.mes.com:8082 #注释相关配置
#因创建私有证书时未设置相关域名直接使用的IP配置