Harbor仓库开启https域名登陆报错问题

出现问题 Error response from daemon: Get “https://reg.hyx.com/v2/”: x509: certificate has expired or is not yet valid

[root@centos12 harbor]# docker login reg.hyx.com
Username: howei
Password: 
Error response from daemon: Get "https://reg.hyx.com/v2/": x509: certificate has expired or is not yet valid: current time 2021-09-07T15:37:01+08:00 is before 2021-09-07T15:25:54Z

网上看到办法很多都是说重新建立证书
总结了一下,最后测试成功使用域名登陆

创建证书就不多说了,harbor安装文章里都有
docker-compose stop
openssl req -newkey rsa:4096 -nodes -sha256 -keyout certs/reg.hyx.com.key -x509 -days 365 -out certs/reg.hyx.com.crt
cd harbor/
vim harbor.yml
./prepare 
./install.sh
以上操作就可以使用https访问harbor了

下来docker login reg.hyx.com登陆问题
cp /data/certs/reg.hyx.com.* /etc/docker/certs.d/reg.hyx.com/	##把上面生成的证书crt和key都给docker下放一份,注意路径
cp /data/certs/reg.hyx.com.crt /etc/docker/certs.d/reg.hyx.com/ca.crt 
##这样复制后/etc/docker/certs.d/reg.hyx.com/会有三个文件reg.hyx.com.crt、reg.hyx.com.key、ca。crt
systemctl restart docker.service
docker-compose down -v
./prepare
docker-compose up -d

操作完成后再登陆私有harbor域名就正常了

[root@centos12 harbor]# docker login reg.hyx.com
Username: howei
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

还有就是配置仓库地址可以设置多个地址

vim /etc/docker/daemon.json
{
  "registry-mirrors": ["https://reg.test.com"]	
}
多个地址配置如
{
  "registry-mirrors": ["https://7777777.mirror.aliyuncs.com"],
  "insecure-registries": ["reg.hyx.com"]
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Howei__

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值