【docker】 追加端口映射时 报错 WARNING: IPv4 forwarding is disabled. Networking will not work.

时间:2021-02-26 05:32:56

【docker】 追加端口映射时 报错 WARNING: IPv4 forwarding is disabled. Networking will not work.

解决办法:

vi /etc/sysctl.conf

添加如下代码:

net.ipv4.ip_forward=

【docker】 追加端口映射时 报错 WARNING: IPv4 forwarding is disabled. Networking will not work.

重启network服务

systemctl restart network

查看;

sysctl net.ipv4.ip_forward

完成以后,删除错误的容器,再次创建新容器,就ok了。