当前位置:   article > 正文

dial tcp: lookup registry-1.docker.io on 192.168.10.1:53: no such host.

lookup registry-1.docker.io on

描述:执行docker run -d nginx:latest或docker pull mysql命令失败

报错信息如下:

[root@node01 ~]# docker run -d nginx:latest
Unable to find image 'nginx:latest' locally
docker: Error response from daemon: Head "https://registry-1.docker.io/v2/library/nginx/manifests/latest": dial tcp: lookup registry-1.docker.io on 192.168.1.1:53: no such host.
See 'docker run --help'.

解决办法:

1) 配置静态IP

[root@node01 ~]#vim /etc/sysconfig/network-scripts/ifcfg-ens33

将BOOTPROTO="dhcp"

改为

BOOTPROTO="static"

添加如下配置:

IPADDR="192.168.16.129"
NETMASK="255.255.255.0"
DNS1="8.8.8.8"
DNS2="8.8.4.4"
GATEWAY="192.168.16.2"
 

2)修改resolv.conf

[root@node01 ~]# vim /etc/resolv.conf
# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 8.8.4.4

3)添加国内镜像

vim /etc/docker/daemon.json

添加如下内容:

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

4)重启docker

systemctl daemon-reload

systemctl restart docker


 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小惠珠哦/article/detail/937237
推荐阅读
相关标签
  

闽ICP备14008679号