【问题标题】:Traefik middle-wares are not working with docker composeTraefik 中间件不适用于 docker compose
【发布时间】:2019-10-05 01:49:41
【问题描述】:

我正在尝试使用 traefik 中间件,但没有一个 traefik 中间件适用于已部署的服务,以下是 docker-compose 文件和 toml 文件。我正在使用 toml 文件初始化 traefik 有人能发现任何错误吗?

version: '3'

services:
  traefik:
    image: traefik
    command: -c /traefik.toml --logLevel=DEBUG
    ports:
      - "80:80"
      - "8086:8080"
    networks:
      - traefik
    volumes:
      - ./traefik.toml:/traefik.toml
      - /var/run/docker.sock:/var/run/docker.sock

  whoami:
    image: emilevauge/whoami
    networks:
      - traefik
    labels:
      - traefik.enable=true
      - "traefik.frontend.rule=Host:link.docker.localhost"

  authservice:
    image: authservice
    networks:
      - traefik
    ports:
      - "7000:80"
    labels:
      - traefik.enable=true
      - "traefik.frontend.rule=Host:authservice.docker.localhost"
      - "traefik.http.middlewares.test-replacepath.replacepath.path=/swagger"

networks:
  traefik:


---------toml file
defaultEntryPoints = ["http", "https"]

[entryPoints]
    [entryPoints.http]
    address = ":80"
    compress = true


[web]
address = ":8080"

[docker]
endpoint = "unix:///var/run/docker.sock"

【问题讨论】:

    标签: docker docker-compose middleware traefik api-gateway


    【解决方案1】:

    您正在混合使用 Traefik v1 和 Traefik v2 配置。

    • traefik.frontend.rule -> Traefik v1
    • traefik.http.middlewares.test-replacepath.replacepath.path -> Traefik v2

    Traefik v1 和 Traefik v2 配置不兼容。

    文档:

    【讨论】:

      猜你喜欢
      • 2017-03-25
      • 1970-01-01
      • 1970-01-01
      • 2017-08-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-24
      相关资源
      最近更新 更多