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

启动docker容器报错

在启动docker容器的时候,遇到以下警告信息:WARNING: IPv4 forwarding is disabled. Networking will not work.

解决办法

  1. 修改配置文件:
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
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
"/usr/lib/sysctl.d/00-system.conf" 10L, 315C

在配置文件中增加以下配置:

 net.ipv4.ip_forward=1
  1. 重启网络
 systemctl restart network
[root@localhost ~]# systemctl restart network
[root@localhost ~]# 
  1. 删掉启动失败的容器
docker rm 容器ID/容器名称
  1. 重启docker
systemctl restart docker

经过以上步骤,再次启动容器,就不会出现这个警告信息提示了。

  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值