报错信息:

[root@localhost ~]# docker run -itd --name jenkins -p 8080:8080 -v /mnt/app/jenkins/:/mnt/ --restart=always jenkinsci/blueocean
WARNING: IPv4 forwarding is disabled. Networking will not work.  //警告信息

[root@localhost ~]# docker info    //有警告信息
......
WARNING: IPv4 forwarding is disabled
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled

环境介绍:

CentOS 7.5
Docker 19.03.8
Docker-compose 1.25.4

解决办法:

1.编辑配置文件/etc/sysctl.conf

新增以下内容:
  net.bridge.bridge-nf-call-ip6tables=1
  net.bridge.bridge-nf-call-iptables=1
  net.bridge.bridge-nf-call-arptables=1
  net.ipv4.ip_forward=1

[root@localhost ~]# vim /etc/sysctl.conf    
...
net.bridge.bridge-nf-call-ip6tables=1
net.bridge.bridge-nf-call-iptables=1
net.bridge.bridge-nf-call-arptables=1
net.ipv4.ip_forward=1

[root@localhost ~]# systemctl restart network      //重启网络配置

2.再次查看docker info,已无警告信息

[root@localhost ~]# docker info
......
 Live Restore Enabled: false

3.重新创建容器,也再无ipv4转发问题警告信息

[root@localhost ~]# docker run -itd --name jenkins -p 8080:8080 -v /mnt/app/jenkins/:/mnt/ --restart=always jenkinsci/blueocean

f7de66534c084cc54feda20badc1fc5aca49a876a2f0473a62c7372f34acb23d

↓↓↓↓↓↓

最近刚申请了个微信公众号,上面也会分享一些运维知识,大家点点发财手关注一波,感谢大家。 【原创公众号】:非著名运维 【福利】:公众号回复 “资料” 送运维自学资料大礼包哦!
Docker中网络不通报错:WARNING: IPv4 forwarding is disabled. Networking will not work解决_Docker