Docker初学者遇到的问题及解决方案

1、安装Docker之后,下载不了镜像,错误为

[root@localhost ~]# docker run hello-world
Unable to find p_w_picpath 'hello-world:latest' locally
Pulling repository docker.io/library/hello-world
docker: Get https://registry-1.docker.io/v1/repositories/library/hello-world/tags/latest: dial tcp: lookup registry-1.docker.io on 172.16.1.2:53: no such host.
See 'docker run --help'.


解决办法,找个合适的***工具.


2、CentOS7防火墙问题,不能使用service控制iptables。 需要安装iptables.services。


3、Docker运行的容器,不能访问外网。需要在主机上设置NAT规则。

iptables -t nat -A POSTROUTING -s 172.17.0.0/16 -j SNAT --to 172.16.1.70
iptables -A FORWARD -s 172.17.0.0/16 -j ACCEPT
iptables -A FORWARD -d 172.17.0.0/16 -j ACCEPT


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章