Zain Malik
Zain Malik

Reputation: 141

Traefik middle-wares are not working with docker compose

I am trying to work with traefik middlewares but none of the traefik middleware is working for deployed service following is the docker-compose file and toml file. I am initializing traefik with a toml file Can someone spot any error?

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"

Upvotes: 0

Views: 1046

Answers (1)

ldez
ldez

Reputation: 3128

You are using a mix of Traefik v1 and Traefik v2 configuration.

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

Traefik v1 and Traefik v2 configuration are not compatible.

The documentations:

Upvotes: 2

Related Questions