解决docker swarm 服务启动后 获取不到真实IP问题

用于修改入口网络路由以向服务容器公开真正的客户端 IP:

docker-ingress-routing-daemon

通过路由和防火墙规则实现;所以
无需运行任何额外的应用层,如Taefik 或其他反向代理;
无需重新配置现有应用程序。

使用教程

docker-ingress-routing-daemon 地址
https://github.com/newsnowlabs/docker-ingress-routing-daemon/
如下载不到请点击这里

https://download.csdn.net/download/qq_35189406/92129476

1.将 docker-ingress-routing-daemon  /usr/local/bin或者/usr/bin(根具系统而定)

2.手动启动测试
启动命令

  全部规则

./docker-ingress-routing-daemon --install --preexisting --ingress-gateway-ips [10段的 ip] 

   指定容器

./docker-ingress-routing-daemon --install --preexisting --services [容器名称] --tcp-ports [容器端口]  --ingress-gateway-ips [10端的 IP]
移除规则
./docker-ingress-routing-daemon --uninstall

注册系统服务 自启

将 dird.service 放入 etc/systemd/system/dird.service

#刷新配置
systemctl daemon-reload
#启用
systemctl enable dird
#启动
systemctl start dird
#状态
systemctl status dird

Logo

码道开发者社区,聚焦华为云码道 CodeArts 代码智能体,沉淀 Agent、Skill、鸿蒙开发实战内容,供开发者查阅资料、交流技术、分享工程实践

更多推荐