[root@mycentos ~]# docker pull bitnami/kafka:latest
latest: Pulling from bitnami/kafka
0796bf144e3f: Already exists
6d8d1650718e: Pulling fs layer
295a174e4cfb: Retrying in 2 seconds
165586489a46: Retrying in 2 seconds
462b8c8ce5a5: Waiting
8a9dcdf65003: Waiting
47c266a8c4bf: Waiting
baacf938d67b: Waiting
4f65080d9aff: Waiting
7598e22d2eda: Waiting
1bed0f0253ed: Waiting
cf9a6955b62d: Waiting
6de0db3a4a7b: Waiting
Get https://registry-1.docker.io/v2/: x509: certificate has expired or is not yet valid
报错信息翻译过来的意思大概是:证书已过期或尚未有效。
在docker拉取镜像时出现 x509 报错,一般都是证书问题或者系统时间问题导致,可以先执行 date 看一下系统时间对不对,如果服务器系统时间跟现实实际时间对不上的话,一般就是系统时间问题,同步时间即可。
# 查看当前时间
[root@mycentos ~]# date
# 安装时间更新工具
[root@mycentos ~]# yum -y install ntpdate
# 更新时间
ntpdate cn.pool.ntp.org
证书问题需要编辑 /etc/docker/daemon.json文件,在配置文件中添加“registry-mirrors”:["https://docker.mirrors.ustc.edu.cn"]配置。
[root@localhost ~]# vim /etc/docker/daemon.json
{
"registry-mirrors":["https://hx983jf6.mirror.aliyuncs.com","https://docker.mirrors.ustc.edu.cn"], //第一个是镜像加速配置
"graph":"/mnt/data" //修改Docker默认存储路径配置
}
[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# systemctl restart docker