启动docker容器报错
在启动docker容器的时候,遇到以下警告信息:WARNING: IPv4 forwarding is disabled. Networking will not work.
解决办法
- 修改配置文件:
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
- 重启网络
systemctl restart network
[root@localhost ~]# systemctl restart network
[root@localhost ~]#
- 删掉启动失败的容器
docker rm 容器ID/容器名称
- 重启docker
systemctl restart docker
经过以上步骤,再次启动容器,就不会出现这个警告信息提示了。