Docker pull error : x509: certificate has expired or is not yet valid

docker2年前 (2021)发布 megou
620 0

最近在做docker pull镜像时,突然报了个错误,提示docker镜像证书无效或过期了,具体报错如下:

[root@zabbix docker]# docker pull mysql
Using default tag: latest
Error response from daemon: Head https://registry-1.docker.io/v2/library/mysql/manifests/latest: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fmysql%3Apull&service=registry.docker.io: x509: certificate has expired or is not yet valid

打开浏览器查看了docker证书生效的,唯一不同的是docker用的aws的证书,大概离可能是centos7操作系统内未内置aws的根证书,造成无法使用。

网上提供了两种解决方案用于解决这个问题,列举下,但不适用与我。

1、本地操作系统时间与docker镜像时间不一致导致证书识别异常,若是此问题通过以下命令修复;

yum -y install ntp

ntpd ntp.aliyun.com

2、告知通过配置docker文件daemon.json来忽略证书问题,一般应该是用于内网搭建的镜像服务器未配置证书吧,具体如下:

{
“registry-mirrors”: [“https://tsfugp9u.mirror.aliyuncs.com”],
“insecure-registries”: [ “0.0.0.0/0” ]
}

最终通过以下方式解决了docker镜像拉取的问题。

[root@zabbix ~]# docker pull tsfugp9u.mirror.aliyuncs.com/grafana/grafana

© 版权声明

相关文章

暂无评论

暂无评论...