执行docker pull nginx 报如下信息:

Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/: x509: certificate has expired or is not yet valid

原因:虚拟机时间与网络时间存在偏差,导致认证失败

解决方法:

安装对时服务:yum install -y ntpdate ntp
在对应文件/etc/ntp.conf 做如下调整:

#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server 0.cn.pool.ntp.org
server 1.cn.pool.ntp.org
server 2.cn.pool.ntp.org
server 3.cn.pool.ntp.org

restrict 0.cn.pool.ntp.org nomodify notrap noquery
restrict 1.cn.pool.ntp.org nomodify notrap noquery
restrict 2.cn.pool.ntp.org nomodify notrap noquery
restrict 3.cn.pool.ntp.org nomodify notrap noquery

server 127.0.0.1 # local clock
fudge 127.0.0.1 stratum 10

启动ntpd服务:systemctl start ntpd
设置开机自启:systemctl enable ntpd

Created symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service.

同步下时间:ntpdate cn.pool.ntp.org

重新执行拉取命令:docker pull nginx

提示信息如下:error pulling image configuration

error pulling image configuration: Get https://production.cloudflare.docker.com/registry-v2/docker/registry/v2/blobs/sha256/9b/9beeba249f3ee158d3e495a6ac25c5667ae2de8a43ac2a8bfd2bf687a58c06c9/data?verify=1590470418-glqVDc5NO266DToSBGaf5frhjWQ%3D: dial tcp 104.18.122.25:443: i/o timeout

更新/etc/docker/daemon.json

{
  "registry-mirrors": ["https://hccwwfjl.mirror.aliyuncs.com"]
}

执行命令:

systemctl daemon-reload
systemctl restart docker

再次执行命令:docker pull nginx

发表评论

电子邮件地址不会被公开。