一叶知秋.

业精于勤,荒于嬉;行成于思,毁于随。

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
……
posted @ 2020-08-06 19:27  ccku  阅读(120)  评论(0编辑  收藏  举报