问题:
关机后开了虚拟机出现如下问题
启动服务时报错:
WARNING: IPv4 forwarding is disabled. Networking will not work.
解决办法:
vi /etc/sysctl.conf
net.ipv4.ip_forward=1 #添加这段代码
#重启network服务
systemctl restart network && systemctl restart docker
#查看是否修改成功 (备注:返回1,就是成功)
[root@docker ~]# sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1
问题解决:
[root@docker ~]# docker container run -d -p 8080:80 --name="lbz_nginx_80" nginx:1.14
6f027718fe344f6ddca02d3c47988865c6b8abd8da414a9a26f34a99724f5802