Docker Pull 镜像时报错

Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io: no such host

分析:抓住结尾 no such host 报错这个是因为dns域名没有解析的原因, 解析不了域名,解析不了主机:registry-1.docker.io 。
解决方式:编辑/etc/resolv.conf 文件,增加一行dns地址,例如:nameserver 8.8.4.4
在/etc/resolv.conf添加dns:

  1. vi /etc/resolv.conf

添加dns解析,如nameserver 8.8.4.4。完整如下:

  1. # This file is managed by man:systemd-resolved(8). Do not edit.
  2. #
  3. # This is a dynamic resolv.conf file for connecting local clients to the
  4. # internal DNS stub resolver of systemd-resolved. This file lists all
  5. # configured search domains.
  6. #
  7. # Run "systemd-resolve --status" to see details about the uplink DNS servers
  8. # currently in use.
  9. #
  10. # Third party programs must not access this file directly, but only through the
  11. # symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
  12. # replace this symlink by a static file or a different symlink.
  13. #
  14. # See man:systemd-resolved.service(8) for details about the supported modes of
  15. # operation for /etc/resolv.conf.
  16. nameserver 8.8.4.4
  17. nameserver 8.8.8.8

重启:systemctl restart network
或者: