What should I do if the docker container cannot access the external network?

王林
Release: 2020-04-14 11:17:14
Original
4503 people have browsed it

What should I do if the docker container cannot access the external network?

问题:

Docker 容器无法访问外网。

解决方法:

vi /etc/sysctl.conf
Copy after login

添加如下代码:

net.ipv4.ip_forward=1
Copy after login

重启network服务

systemctl restart network
Copy after login

查看是否修改成功

sysctl net.ipv4.ip_forward
Copy after login

结果

net.ipv4.ip_forward = 1
Copy after login

推荐教程:docker教程

The above is the detailed content of What should I do if the docker container cannot access the 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