环境说明

我搭建的harbor仓库,是需要用域名和https方式访问

报错一,其他docker环境登陆harbor时

[root@k8s0001 ~]# docker login www.harbor.wuhan.cn
Username: admin
Password: 
Error response from daemon: Get "https://www.harbor.wuhan.cn/v2/": x509: certificate signed by unknown authority

报错二,其他docker环境拉取自建harbor仓库镜像时

[root@k8s0001 ~]# docker pull www.harbor.wuhan.cn/22202/helloworld@sha256:0d9ce49958ea82a48c40a397ccc785674ec3ce1dfd4f749c3c7c7a63790a54cd
Error response from daemon: Get "https://www.harbor.wuhan.cn/v2/": x509: certificate signed by unknown authority

这两个报错的需要把生成的密钥cp到对应机器docker的配置文件目录即可,操作如下:

配置https链接

##harbor所在服务器
[root@harbor opt]# cd /etc/docker/
[root@harbor docker]# ls
certs.d  key.json
[root@harbor docker]# cd certs.d/
[root@harbor certs.d]# ls
www.harbor.wuhan.cn
[root@harbor certs.d]# cd www.harbor.wuhan.cn/
[root@harbor www.harbor.wuhan.cn]# ls
ca.crt  www.harbor.wuhan.cn.cert  www.harbor.wuhan.cn.key
[root@harbor certs.d]# cd ..
[root@harbor certs.d]# scp -r www.harbor.wuhan.cn root@192.168.9.78:/etc/docker/certs.d/ 
root@192.168.9.78's password: 
www.harbor.wuhan.cn.cert                                                                          100% 2126   914.9KB/s   00:00    
www.harbor.wuhan.cn.key                                                                           100% 3243     1.5MB/s   00:00    
ca.crt                                                                                             100% 2033   839.2KB/s   00:00    
[root@harbor certs.d]# 
[root@harbor certs.d]# scp -r www.harbor.wuhan.cn root@192.168.9.79:/etc/docker/certs.d/
root@192.168.9.79's password: 
www.harbor.wuhan.cn.cert                                                                          100% 2126   845.3KB/s   00:00    
www.harbor.wuhan.cn.key                                                                           100% 3243     1.9MB/s   00:00    
ca.crt                                                                                             100% 2033     1.8MB/s   00:00    
[root@harbor certs.d]# 
[root@harbor certs.d]# 
[root@harbor certs.d]# scp -r www.harbor.wuhan.cn root@192.168.9.80:/etc/docker/certs.d/
root@192.168.9.80's password: 
www.harbor.wuhan.cn.cert                                                                          100% 2126   227.8KB/s   00:00    
www.harbor.wuhan.cn.key                                                                           100% 3243     2.5MB/s   00:00    
ca.crt                                                                                             100% 2033     1.2MB/s   00:00 

然后重启上述docker即可

[root@k8s0001 opt]# systemctl restart docker
[root@k8s0002 opt]# systemctl restart docker
[root@k8s0003 opt]# systemctl restart docker
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐