docker 容器启动提示,ipv4不能被使用

时间:2024-03-11 18:25:59

docker容器的启动成功,但是通过URL不能被访问到的原因

vi /etc/sysctl.conf
# 新增一行
 net.ipv4.ip_forward=1
#  重启network服务
systemctl restart network
# 查看是否修改成功,注意是sysctl
sysctl net.ipv4.ip_forward
(返回为“net.ipv4.ip_forward = 1”,表示成功)

“ default the ipv4 forwarding is not turned on in the image from docker to prevent any security vulnerabilities. ”
Docker处于安全考虑默认关闭该设置。