Problem description:
When I was setting up the redis environment with docker today, I found that yum could not pull resources and could not access the Internet. The following error was reported:
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.
Solution process:
1. Test wget
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
The result is an error
unknown host mirrors.163.com
2. Test ping
inside the container
ping www.baidu.com
The result still failed
ping: unknown host www.baidu.com
Open an additional terminal, enter the host (not the container), conduct a ping command test and find that it is OK. It can basically be determined that it is a problem with docker, not Internet problem.
Solution:
Stop all containers and restart docker.
service docker restart
Done!
Recommended tutorial: docker tutorial
The above is the detailed content of How to solve the problem that the docker container cannot ping the external network. For more information, please follow other related articles on the PHP Chinese website!