您的位置:首页 > 运维架构 > Docker

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

2018-12-18 10:27 507 查看

第一次启动还正常呢,第二次启动就不可以了。

[root[@xxxxxx](https://my.oschina.net/xxww) ~]#  docker run -d -P training/webapp python app.py
WARNING: IPv4 forwarding is disabled. Networking will not work.
a73aab05adde4xxxxxxxxxxff205ba8a9262bcb6759fda787e30764b6a32963e

解决办法: 在宿主机(就是Docker所在的操作系统)上操作

  1. 修改 /usr/lib/sysctl.d/00-system.conf 文件,在结尾添加 net.ipv4.ip_forward=1

    [root[@xxxxxx](https://my.oschina.net/xxww) ~]# vim /usr/lib/sysctl.d/00-system.conf
    
    # Kernel sysctl configuration file
    #
    # For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and
    # sysctl.conf(5) for more details.
    
    # Disable netfilter on bridges.
    net.bridge.bridge-nf-call-ip6tables = 0
    net.bridge.bridge-nf-call-iptables = 0
    net.bridge.bridge-nf-call-arptables = 0
    net.ipv4.ip_forward=1
  2. 然后重启 network

    [root[@xxxxxx](https://my.oschina.net/xxww) ~]# systemctl restart network

再执行启动容器就可以了

[root[@bogon](https://my.oschina.net/u/3914826) sysctl.d]#  docker run -d -P training/webapp python app.py
5b5783abf0a2xxxxxxxxxx5ec5f79099415ad46e18122aa120852d47958b5eb7

参考文档:Locutus

(adsbygoogle = window.adsbygoogle || []).push({});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  arptables Docker
相关文章推荐