Home >Operation and Maintenance >Docker >What should I do if the docker container cannot access the external network?

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

王林
王林Original
2020-04-14 11:17:144557browse

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

问题:

Docker 容器无法访问外网。

解决方法:

vi /etc/sysctl.conf

添加如下代码:

net.ipv4.ip_forward=1

重启network服务

systemctl restart network

查看是否修改成功

sysctl net.ipv4.ip_forward

结果

net.ipv4.ip_forward = 1

推荐教程: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!

Statement:
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