Harbor/Docker: x509: certificate signed by unknown authority
程序员文章站
2021-12-08 19:22:19
完成Harbor安装之后,我们使用docker login/push/pull去与Harbor打交道,上传下载镜像等。 但是发现出现x509: certificate signed by unknown authority之类的错误。[root@test01 harbor.dev]# docker login harbor.devAuthenticating with existing credentials...Login did not succeed, error: Error respon...
完成Harbor安装之后,我们使用docker login/push/pull去与Harbor打交道,上传下载镜像等。 但是发现出现x509: certificate signed by unknown authority之类的错误。
[root@test01 harbor.dev]# docker login harbor.dev
Authenticating with existing credentials...
Login did not succeed, error: Error response from daemon: Get https://harbor.dev/v2/: x509: certificate signed by unknown authority
Username (admin): admin
Password:
Error response from daemon: Get https://harbor.dev/v2/: x509: certificate signed by unknown authority
从字面意思很容易理解,表示证书是被不知名的ca签名的,因为是自建的证书,肯定是有问题。 如果我们用google浏览器打开harbor, 同样会显示证书错误的提示,输入神奇字符: thisisunsafe 才可以登入。
解决这问题很简单,参阅docker官方文档:
https://docs.docker.com/engine/security/certificates/
从官方文档提示,客户端要使用tls与Harbor通信,使用的还是自签证书,那么必须建立一个目录:/etc/docker/certs.d
在这个目录下建立签名的域名的目录,比如域名为harbor.dev, 那么整个目录为: /etc/docker/certs.d/harbor.dev, 然后把harbor的证书拷贝到这个目录即可。
[root@test01 harbor.dev]# pwd
/etc/docker/certs.d/harbor.dev
[root@test01 harbor.dev]# cp /tmp/harbor.crt .
[root@test01 harbor.dev]# docker login harbor.dev
Authenticating with existing credentials...
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
官方提示把所有的crt,包括根证书ca.crt拷贝到这个目录,实际上只需要拷贝Harbor的证书即可,根证书都不需要。
本文地址:https://blog.csdn.net/tom_fans/article/details/107620248
推荐阅读
-
解决golang https请求提示x509: certificate signed by unknown authority
-
解决golang https请求提示x509: certificate signed by unknown authority
-
Harbor/Docker: x509: certificate signed by unknown authority
-
kubectl get node报Unable to connect to the server: x509: certificate signed by unknown authority。。。
-
Harbor/Docker: x509: certificate signed by unknown authority