问题:
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!