Docker 启动容器时,报错 WARNING:IPv4 forwarding is disabled. Networking will not work. 的解决办法

 

Centos 7 Docker 启动了一个web服务 但是启动时 报

WARNING: IPv4 forwarding is disabled. Networking will not work.

 

解决办法:

[root@docker01~]# vi /etc/sysctl.conf

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

 

# 修改生效

[root@docker01~]# sysctl -p

 

# 重启network服务

[root@docker01~]# systemctl restart network && systemctl restart docker

 

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

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

 

posted on 2019-12-09 13:30  morgan363  阅读(243)  评论(0编辑  收藏  举报

导航