docker dockerfile [Warning] IPv4 forwarding is disabled. Networking will not work.解决办法

root@localhost ~]# docker build -t test1 .

…省略…

WARNING: IPv4 forwarding is disabled. Networking will not work.

error:xxxxxxx

解决办法:

在宿主机上面执行:

net.ipv4.ip_forward=1 >> /usr/lib/sysctl.d/00-system.conf


vi /usr/lib/sysctl.d/00-system.conf
追加
net.ipv4.ip_forward=1

docker dockerfile [Warning] IPv4 forwarding is disabled. Networking will not work.解决办法_第1张图片

重启network和docker服务

systemctl restart network && systemctl restart docker

成功解决!!

你可能感兴趣的:(docker)