docker container cannot ping external network

Release: 2020-03-25 12:57:46
Original
3399 people have browsed it

docker container cannot ping external network

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.
Copy after login

Testing wget

wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
Copy after login

Result error

unknown host mirrors.163.com
Copy after login

Test ping

在容器内部
ping www.baidu.com
Copy after login

The result still failed

ping: unknown host www.baidu.com
Copy after login

Open an additional terminal, enter the host (not the container), and perform the ping command test It is found that it is OK. It is basically determined that it is a docker problem, not a network problem.

Solution

Stop all containers and restart docker

service docker restart
Copy after login

More related tutorials, Please pay attention to the docker tutorial column on the PHP Chinese website.

The above is the detailed content of docker container cannot ping external network. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!