docker pull 出现Error response from daemon: Get https://registry-1.docker.io/ 错误解决记录

错误提示:

[[email protected] yum.repos.d]# docker pull redis
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 8.8.8.8:53: read udp 192.168.137.101:44205->8.8.8.8:53: i/o timeout


[[email protected] ~]# docker search mysql
Error response from daemon: Get https://index.docker.io/v1/search?q=mysql&n=25: x509: certificate signed by unknown authority

解决方法:

配置daemon.json文件

1)由于国内访问直接访问docker网速比较慢,拉取镜像的时间就会比较长。一般使用镜像加速或者直接从国内的一些平台镜像仓库上拉取,配置镜像加速registry-mirrors

2)配置insecure-registries:字面意思为不安全的仓库,通过添加这个参数对非https仓库进行授信,可以设置多个insecure-registries地址,以数组形式书写,地址不能添加协议头(http)

[[email protected] docker]#cat /etc/docker/daemon.json

{

 "registry-mirrors": ["https://pee6w651.mirror.aliyuncs.com","http://hub-mirror.c.163.com"],

  "insecure-registries":["hub.c.163.com","hub-auth.c.163.com","index.docker.io"]

}

保存退出,执行:

systemctl daemon-reload

service docker restart

验证测试:

docker pull 出现Error response from daemon: Get https://registry-1.docker.io/ 错误解决记录