docker pull 报错解决办法

今天在使用docker 时,将 image 文件从仓库抓取到本地一直报错,经过尝试,终于得以解决。

错误信息如下:

[docker@web-test ~]$ docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
f5d23c7fed46: Already exists 
918b255d86e5: Downloading 
8c0120a6f561: Download complete 
Get https://registry-1.docker.io/v2/: x509: certificate is valid for goldopen.org, www.goldopen.org, not registry-1.docker.io

解决方法如下:

第一步:通过dig @114.114.114.114 registry-1.docker.io找到可用IP

[root@archlinux ~]# dig @114.114.114.114 registry-1.docker.io 
.
.
.
;; ANSWER SECTION:
registry-1.docker.io.   30      IN      A       34.199.77.19
registry-1.docker.io.   30      IN      A       34.206.236.31
.
.

  

第二步:尝试修改/etc/hosts强制docker.io相关的域名解析到其它可用IP

vim /etc/hosts

添加一个可用IP:

34.199.77.19 registry-1.docker.io

原文地址:https://www.cnblogs.com/lichenghong/p/11313567.html