当前位置: 代码迷 >> 综合 >> docker学习遇到的问题1--WARNING: IPv4 forwarding is disabled. Networking will not work.
  详细解决方案

docker学习遇到的问题1--WARNING: IPv4 forwarding is disabled. Networking will not work.

热度:82   发布时间:2024-02-05 13:51:10.0

问题:

关机后开了虚拟机出现如下问题
启动服务时报错:
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
  相关解决方案