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


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