flask - Traefik2 将多个服务路由到烧瓶中的多个子路径
问题描述
我对烧瓶运行的多个服务有疑问。如果我评论服务 app1 或 app2,一切正常。但是当我同时运行两个服务和“curl localhost/app1”时,我得到了 404 错误。“curl localhost/app2”效果很好。
这是 docker-compose.yml。
version: "2.4"
services:
traefik:
image: "traefik:v2.1.3"
container_name: "traefik"
command:
#- "--log.level=DEBUG"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
ports:
- "80:80"
- "8080:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
app1:
image: pytorch:1.4.0
build:
context: .
target: prod
dockerfile: ./app1/Dockerfile
labels:
- traefik.enable=true
- "traefik.http.routers.app1.rule=Path(`/app1`)"
- "traefik.http.routers.app1.entrypoints=web"
app2:
image: pytorch:1.4.0
build:
context: .
target: prod
dockerfile: ./app2/Dockerfile
labels:
- traefik.enable=true
- "traefik.http.routers.app2.rule=Path(`/app2`)"
- "traefik.http.routers.app2.entrypoints=web"
解决方案
推荐阅读
- php - 使用 GD 在图像上写入文本不起作用
- reactjs - expo-sqlite 不要将数据插入本机反应
- python - 如何在 Django 中打印元组的名称?
- image - Flutter:- 如何检查 Gif 是否加载
- c# - System.DllNotFoundException:'无法加载 DLL'libzkfp.dll':找不到指定的模块。(来自 HRESULT 的异常:0x8007007E)'
- php - Vips writeToBuffer 不应用图像质量
- dotnetnuke - 2sxc“与服务器交谈时出错(状态 403)”
- react-native - 在 redux 存储状态更改后导航到初始 Route
- java - 如何最好地实现 ViewModel(在 AndroidX 中)以使数据在配置更改中幸存下来
- javascript - 我的 Discord Bot 在触发时不断发送相同的图像