No way to get dashboard to work in secure mode

I am trying to understand how to make dashboard in secure mode with Docker Swarm work locally, but I can't get it to work. The documentation is not helpful at all in this case, as it sucks. This is my configuration:
Static config:

level = "INFO"


dashboard = true

    address = ":80"

    address = ":443"

endpoint = "unix:///var/run/docker.sock"
exposedByDefault = false
swarmMode = true
swarmModeRefreshSeconds = 15
watch = true

    usersFile = "/etc/httpd/.htpasswd"

and then in docker stack file:

    image: traefik:v2.3
        - "traefik.enable=true"
        - "traefik.http.routers.dashboard.rule=Host(`traefik.domain.tld`)" # This domain is defined locally in /etc/hosts
        - "traefik.http.routers.dashboard.middlewares=basic-auth"
        - "traefik.http.routers.dashboard.service=api@internal"
        - "traefik.http.routers.dashboard.entrypoints=web"
          - "node.labels.role==master"
        condition: on-failure
        delay: 1s
        window: 10s
      - public
      - target: 80
        published: 80
        protocol: tcp
        mode: host
      - target: 443
        published: 443
        protocol: tcp
        mode: host
      - 8080:8080
      - ./config/traefik/traefik.toml:/etc/traefik/traefik.toml:ro
      - /etc/httpd/.htpasswd:/etc/httpd/.htpasswd:ro
      - /var/run/docker.sock:/var/run/docker.sock

I have no idea what is wrong here and I waster hours to get it to work with no result. Do I need to have SSL enabled for it to work? Is there a mistake in my configuration? I have no idea.
All I get is 404.

Thank you very much!


The http.middlewares configuration is a part of the dynamic configuration.

The file traefik.toml contains the static configuration.

So you have to create a dedicated file to put the dynamic configuration and use the file provider.

Thank you, it works! Documentation can be very confusing sometimes and me trying to things the most efficient way (at least according to me) didn't help :slight_smile:

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