【发布时间】:2020-08-27 14:18:13
【问题描述】:
我一直在尝试使用基本的官方指南设置 traefik v2.2。我有一个 Spring Boot 服务,我已经容器化并且工作正常。
这是我的 Spring Boot 服务的 docker compose:
version: "3"
services:
spring-boot-traefik-app:
image: spring-boot-traefik-example:latest
labels:
- "traefik.http.routers.spring-boot-traefik-app.rule=Host(`springboot.traefik.app`)"
这是我的 Traefik docker compose :
version: "3"
services:
reverse-proxy:
# The official v2 Traefik docker image
image: traefik:v2.2
# Enables the web UI and tells Traefik to listen to docker
command:
- "--api.insecure=true"
- "--providers.docker=true"
ports:
# The HTTP port
- "80:80"
# The Web UI (enabled by --api.insecure=true)
- "8080:8080"
volumes:
# So that Traefik can listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock
现在,我正在尝试通过以下方式发出 curl 请求:
curl -H Host:springboot.traefik.app http://127.0.0.1
由于我只是在上下文路径“/”上返回服务信息,它应该返回给我一些东西。服务独立工作正常。但是当我尝试在代理后面运行时,它会给我网关超时错误。我不确定 traefik 是否正常工作。我错过了什么吗?官方指南使用 whoami 图像,这是我试图用 Spring boot 创建的。此外,traefik 仪表板可以正确显示详细信息。
【问题讨论】:
-
嗨,你最终解决了这个问题吗?我有同样的问题。使用文件配置和 springboot 应用程序,只需获得网关超时。
-
嘿@Dan,我找不到解决方案。幸运的是,这是我最喜欢的项目,旧版 Traefik 运行良好
标签: spring-boot docker docker-compose traefik