Traefik2将多个服务路由到flask中的多个子路径

Traefik2将多个服务路由到flask中的多个子路径,flask,traefik,Flask,Traefik,我对flask运行的多个服务有问题。 如果我评论服务app1或app2,一切都很好。 但当我同时运行两个sevicve和“curl localhost/app1”时,我得到了404错误。 “curl localhost/app2”非常有效 这是docker-compose.yml version: "2.4" services: traefik: image: "traefik:v2.1.3" container_name: "traefik" command:

我对flask运行的多个服务有问题。 如果我评论服务app1或app2,一切都很好。 但当我同时运行两个sevicve和“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"