Traefik v2.5 configuration issues

i used docker-composer install:

version: '3'
services:
  reverse-proxy:
    # The official v2 Traefik docker image
    image: traefik:v2.5
    # Enables the web UI and tells Traefik to listen to docker
    command: --api.insecure=true --providers.docker
    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
      - /etc/traefik/traefik.yml:/etc/traefik/traefik.yml:ro
      - /var/run/docker.sock:/var/run/docker.sock
  whoami:
    image: containous/whoami
    labels:
      - "traefik.http.routers.mctest.rule=Host(`mctest.org`)"

and traefik.yml:

http:
  routers:
    transfor:
      rule: "Path(`/transfor`)"
      service: "service-transfor"
  services:
    service-transfor:
      loadBalancer:
        servers:
          - url: "http://10.10.3.219/"

docker error logs:

2021/10/10 17:01:34 command traefik error: no valid configuration found in file: /etc/traefik/traefik.yml

i fixed.

router.yml

http:
  routers:
    transfor:
      rule: "Path(`/transfor`)"
      service: "service-transfor"
      middlewares:
        - "example"
  services:
    service-transfor:
      loadBalancer:
        servers:
          - url: "http://10.10.3.219"
  middlewares:
    example:
      stripPrefix:
        prefixes:
          - "/transfor"

docker compose.yml:

version: '3'
services:
  reverse-proxy:
    # The official v2 Traefik docker image
    image: traefik:v2.5
    # Enables the web UI and tells Traefik to listen to docker
    command: --api.insecure=true --providers.docker --providers.file.filename=/etc/traefik/router.yml
    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
      - /etc/traefik/:/etc/traefik/:ro
      - /var/run/docker.sock:/var/run/docker.sock
  whoami:
    image: containous/whoami
    labels:
      - "traefik.http.routers.mctest.rule=Host(`mctest.org`)"

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.