2.2.8 Minimal configuration for dashboard not working

Hello there,

I wish to try upgrading to Traefik v2 but I'm not able to setup a minimal configuration with dashboard enabled. Traefik starts up but trying to access Dashboard or API always results in HTTP Error 404

# docker-compose.yml
version: '3.0'

services:
  traefik:
    image: traefik:2.2.8
    ports:
    - "80:80"
    volumes:
    - "./traefik.yml:/etc/traefik/traefik.yml"
    - "/var/run/docker.sock:/var/run/docker.sock"
    networks:
    - main

networks:
  main:
    driver: bridge

# traefik.yml
log:
  level: DEBUG

api:
  dashboard: true

http:
  routers:
    dashboard:
      rule: Host('traefik.localhost')
      service: "api@internal"

Tested URLs:

What am I missing ?

in the v2, the dynamic configuration and the static configuration must be defined in separated files:

A minimal example:

version: '3.7'

services:

  traefik:
    image: traefik:v2.2.8
    command:
      # - --log.level=DEBUG
      - --api
      - --providers.docker.exposedbydefault=false
      - --entrypoints.web.address=:80
      - --entrypoints.web.http.redirections.entrypoint.to=websecure
      - --entrypoints.web.http.redirections.entrypoint.scheme=https
      - --entrypoints.websecure.address=:443
      - --entrypoints.websecure.http.tls=true
    ports:
      - 80:80
      - 443:443
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    labels:
      traefik.enable: "true"

      # Dashboard
      traefik.http.routers.traefik.rule: Host(`traefik.localhost`)
      traefik.http.routers.traefik.entrypoints: websecure
      traefik.http.routers.traefik.service: api@internal

  whoami:
    image: containous/whoami:v1.5.0
    labels:
      traefik.enable: "true"

      traefik.http.routers.app.rule: Host(`whoami.localhost`)
      traefik.http.routers.app.entrypoints: websecure
1 Like

Ok thank you !

I find static / dynamic meaning not exaclty what I'm expecting ... I thought static was everything that's define at startup. I think only the picture is really explicit:

However, here is the final configuration for future reader:

# docker-compose.yml
version: '3.0'

services:
  traefik:
    image: traefik:2.2.8
    ports:
    - "80:80"
    volumes:
    - "./etc:/etc/traefik"
    - "/var/run/docker.sock:/var/run/docker.sock"
    networks:
    - main

networks:
  main:
    driver: bridge


# ./etc/traefik.yml
log:
  level: DEBUG

api:
  dashboard: true

providers:
  file:
    directory: /etc/traefik/config.d


# ./etc/config.d/traefik-dashboard.yml
http:
  routers:
    dashboard:
      rule: Host(`traefik.localhost`)
      service: "api@internal"