您好,欢迎访问一九零五行业门户网

docker容器无法ping外网

今天在docker搭建redis环境的时候,发现yum拉取不到资源,上不到网,报了如下错误:
http://mirrors.aliyun.com/centos/6.10/extras/x86_64/packages/epel-release-6-8.noarch.rpm: [errno 14] pycurl error 6 - "couldn't resolve host 'mirrors.aliyun.com'"trying other mirror.http://mirrors.neusoft.edu.cn/centos/6.10/extras/x86_64/packages/epel-release-6-8.noarch.rpm: [errno 14] pycurl error 6 - "couldn't resolve host 'mirrors.neusoft.edu.cn'"trying other mirror.http://mirrors.nwsuaf.edu.cn/centos/6.10/extras/x86_64/packages/epel-release-6-8.noarch.rpm: [errno 14] pycurl error 6 - "couldn't resolve host 'mirrors.nwsuaf.edu.cn'"trying other mirror.http://mirrors.shu.edu.cn/centos/6.10/extras/x86_64/packages/epel-release-6-8.noarch.rpm: [errno 14] pycurl error 6 - "couldn't resolve host 'mirrors.shu.edu.cn'"trying other mirror.http://mirrors.sohu.com/centos/6.10/extras/x86_64/packages/epel-release-6-8.noarch.rpm: [errno 14] pycurl error 6 - "couldn't resolve host 'mirrors.sohu.com'"trying other mirror.http://mirrors.tuna.tsinghua.edu.cn/centos/6.10/extras/x86_64/packages/epel-release-6-8.noarch.rpm: [errno 14] pycurl error 6 - "couldn't resolve host 'mirrors.tuna.tsinghua.edu.cn'"trying other mirror.http://mirrors.zju.edu.cn/centos/6.10/extras/x86_64/packages/epel-release-6-8.noarch.rpm: [errno 14] pycurl error 6 - "couldn't resolve host 'mirrors.zju.edu.cn'"trying other mirror.
测试wget
wget http://mirrors.163.com/.help/centos6-base-163.repo
结果报错
unknown host mirrors.163.com
测试ping
在容器内部ping www.baidu.com
结果还是失败
ping: unknown host www.baidu.com
多开一个终端,进入主机(不是进入容器),进行ping命令测试发现是ok的,基本可以确定是docker的问题了,而不是网络问题
解决方法
停止所有容器,重启docker
service docker restart
更多相关教程,请关注docker教程栏目。
以上就是docker容器无法ping外网的详细内容。
其它类似信息

推荐信息