docker容器无法ping外网_网站服务器运行维护,docker

docker容器调用yum报错如何解决_网站服务器运行维护

docker容器调用yum报错解决方法:把宿主机上同路径下的源拷贝到容器里面,然后docker commit一个新的“基础镜像”,然后就可以正常使用了。

今天在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

怎么查看docker容器的ip是多少_网站服务器运行维护

查看docker容器IP的方法:1、安装ifconfig命令,可以使用yum直接安装。2、然后直接使用ifconfig命令查看docker容器IP。

在容器内部
ping www.baidu.com

结果还是失败

ping: unknown host www.baidu.com

多开一个终端,进入主机(不是进入容器),进行ping命令测试发现是OK的,基本可以确定是docker的问题了,而不是网络问题

解决方法

停止所有容器,重启docker

service docker restart

更多相关教程,请关注ki4网docker教程栏目。

以上就是docker容器无法ping外网的详细内容,更多请关注ki4网其它相关文章!

centos如何升级_网站服务器运行维护

centos升级的方法:可以依次执行“sudo yum clean all”与“sudo yum update”命令将centos升级为最新版。

点赞

发表评论

电子邮件地址不会被公开。必填项已用 * 标注