【docker】解决报错 WARNING: IPv4 forwarding is disabled. Networking will not work.
https://blog.csdn.net/weixin_68100450/article/details/126054580
一,docker 运行直接报错
报错:
[root@localhost /]# docker run -it ubuntu /bin/bash
WARNING: IPv4 forwarding is disabled. Networking will not work.
1.解决方式:
第一步:在宿主机上执行echo "net.ipv4.ip_forward=1" >>/usr/lib/sysctl.d/00-system.conf
2.第二步:重启network和docker服务
[root@localhost /]# systemctl restart network && systemctl restart docker
3.第三步:验证是否成功
可见完美解决问题。
二,docker容器运行镜像的时候也是报这种错误,相对应得也是重启一下docker就可