docker启动WARNING:IPv4 forwarding is disabled. Networking will not work.

docker启动容器报错IPv4 forwarding is disabled. Networking will not work.

[root@localhost ~]# docker run -p 3376:3306  -d  mysql
WARNING: IPv4 forwarding is disabled. Networking will not work.
51d6a8a733e42c7c7c2188aa37ef2126dc1d403ff3de7151f6e7e4b95bb8af2d

  

解决办法:

[root@localhost ~]# vim /etc/sysctl.conf 

net.ipv4.ip_forward=1  #添加这段代码

 

#重启network服务

[root@localhost ~]# systemctl restart network

  

#查看是否修改成功 (备注:返回1,就是成功)

[root@localhost ~]# sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1

  

posted @ 2019-11-12 20:56  yvioo  阅读(205)  评论(0编辑  收藏  举报