问题:

[yuyongxr@localhost ~]$sudo docker run -d --name nginx -p 80:8080 nginx   
WARNING: IPv4 forwarding is disabled. Networking will not work.

 

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

解决方法:

[yuyongxr@localhost ~]$ sudo vim /usr/lib/sysctl.d/00-system.conf
#添加如下代码:
net.ipv4.ip_forward=1

 

重启network和docker服务

 
[yuyongxr@localhost ~]$ sudo systemctl restart network
[yuyongxr@localhost ~]$ sudo systemctl restart docker

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄