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
……