Leif160519的blog Leif160519的blog

——————

目录
centos 7 Docker容器启动报WARNING: IPv4 forwarding is disabled. Networking will not work
/    

centos 7 Docker容器启动报WARNING: IPv4 forwarding is disabled. Networking will not work

/etc/sysctl.conf或者/usr/lib/sysctl.d/00-system.conf中添加如下代码:

net.ipv4.ip_forward=1

重启network服务

systemctl restart network

查看是否修改成功

sysctl net.ipv4.ip_forward

如果返回为net.ipv4.ip_forward = 1则表示成功了

这时,重启容器即可。

另外还可以通过run时加-p 参数指定IP的方式来解决,比如 -p 0.0.0.0:999:999(指定ip就按ipv4来,否则默认全部是ipv6的。)


“The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.” – Tom Cargill

标  题centos 7 Docker容器启动报WARNING: IPv4 forwarding is disabled. Networking will not work
作  者Leif160519
出  处https://github.icu/articles/2019/08/29/1567039614648.html
关于博主:坐标六朝古都南京,服务器运维工程师+桌面运维工程师,如有问题探讨可以直接下方留言。
声援博主:如果您觉得文章对您有帮助,可以评论、订阅、收藏。您的鼓励是博主的最大动力!