[Docker][WARNING]:IPv4 forwarding is disabled. Networking will not work.
刚从VMware16克隆装了docker的centos7的虚拟机,改完IP,启动镜像,发现docker的mysql数据库连不上,重新docker run 发现报了这个warning:IPv4 forwarding is disabled. Networking will not work.
通过上网查应该是网桥配置后,要开启转发,不然容器启动后没有网络。
需配置 /etc/sysctl.conf, 添加net.ipv4.ip_forward=1即可,操作如下
vim /etc/sysctl.conf
#配置转发
net.ipv4.ip_forward=1
#重启网络
systemctl restart network
#查看是否成功
sysctl net.ipv4.ip_forward
#返回
net.ipv4.ip_forward=1

浙公网安备 33010602011771号