WARNING: IPv4 forwarding is disabled. Networking will not work.
WARNING: IPv4 forwarding is disabled. Networking will not work.
[root@aaa ~]# docker run -it --name mycentos centos
WARNING: IPv4 forwarding is disabled. Networking will not work.
解决方法:
退出容器
[root@aaa ~]# echo "net.ipv4.ip_forward=1" >> /usr/lib/sysctl.d/00-system.conf
[root@aaa ~]# systemctl restart network && systemctl restart docker
验证:
[root@aaa ~]# docker start 835ae0a87cd0
835ae0a87cd0
[root@aaa ~]# docker attach 835ae0a87cd0
[root@835ae0a87cd0 /]# ping www.baidu.com
PING www.a.shifen.com (61.135.169.125) 56(84) bytes of data.
64 bytes from 61.135.169.125 (61.135.169.125): icmp_seq=1 ttl=127 time=39.9 ms
……
作者:ccku
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。如有问题或建议,请多多赐教,非常感谢。