当前位置:   article > 正文

docker run hello-world报错:Unable to find image ‘hello-world:latest‘ locally_unable to find image 'hello-world:latest' locally

unable to find image 'hello-world:latest' locally docker: error response fro

报错提示:

Unable to find image 'hello-world:latest' locally

docker: Error response from daemon: Head "https://registry-1.docker.io/v2/library/hello-world/manifests/latest": dial tcp: lookup registry-1.docker.io on 192.168.230.2:53: no such host.

See 'docker run --help'.

解决方法:

首先检查DNS,如果DNS没有配置,需要添加DNS地址。编辑:vim /etc/sysconfig/network-scripts/ifcfg-eno16777736

1、新版的 Docker 使用 /etc/docker/daemon.json来配置 Daemon,修改vim /etc/docker/daemon.json文件

2、添加以下内容并保存

{

"registry-mirrors": ["https://<你的ID>.mirror.aliyuncs.com"]

}

3、通过dig @114.114.114.114 registry-1.docker.io找到可用IP

; <<>> DiG 9.9.4-RedHat-9.9.4-29.el7 <<>> @114.114.114.114 registry-1.docker.io

; (1 server found)

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4705

;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:

; EDNS: version: 0, flags:; udp: 512

;; QUESTION SECTION:

;registry-1.docker.io. IN A

;; ANSWER SECTION:

registry-1.docker.io. 122 IN A 34.205.13.154

registry-1.docker.io. 122 IN A 44.205.64.79

registry-1.docker.io. 122 IN A 3.216.34.172

;; Query time: 61 msec

;; SERVER: 114.114.114.114#53(114.114.114.114)

;; WHEN: 四 3月 09 17:04:47 CST 2023

;; MSG SIZE rcvd: 97

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

vim /etc/hosts添加↓

34.205.13.154 registry-1.docker.io

44.205.64.79 registry-1.docker.io

3.216.34.172 registry-1.docker.io

5、手动pull: docker image pull library/hello-world

6、验证docker image ls

REPOSITORY TAG IMAGE ID CREATED SIZE

hello-world latest feb5d9fea6a5 17 months ago 13.3kB

7、执行run hello-world成功

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

闽ICP备14008679号