心心失意 发表于 2018-5-29 12:34:04

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

  1、安装Docker之后,下载不了镜像,错误为
# docker run hello-world
Unable to find image '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  
页: [1]
查看完整版本: Docker初学者遇到的问题及解决方案