扫码关注官方订阅号
docker 容器连不了网,怎么处理
学习是最好的投资!
宿主机内运行 sysctl net.ipv4.conf.all.forwarding 确保这个转发功能为开启。如果没开的话运行 sysctl net.ipv4.conf.all.forwarding=1 开启它。
sysctl net.ipv4.conf.all.forwarding
sysctl net.ipv4.conf.all.forwarding=1
我之前遇到过这个问题,是因为修改了防火墙设置导致的,重启 docker 服务可以解决了。
楼主可以尝试下重启 docker 服务,centos 是 service docker restart
service docker restart
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
扫描下载App
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
宿主机内运行
sysctl net.ipv4.conf.all.forwarding
确保这个转发功能为开启。如果没开的话运行
sysctl net.ipv4.conf.all.forwarding=1
开启它。我之前遇到过这个问题,是因为修改了防火墙设置导致的,重启 docker 服务可以解决了。
楼主可以尝试下重启 docker 服务,centos 是
service docker restart