报错提示:
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文章来源:https://www.toymoban.com/news/detail-533519.html
7、执行run hello-world成功文章来源地址https://www.toymoban.com/news/detail-533519.html
到了这里,关于docker run hello-world报错:Unable to find image ‘hello-world:latest‘ locally的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!