Unable to get dashboard working from localhost subdomain

Hello all,

I'm trying to make the dashboard available localally, on traefik.localhost without any SSL or certificate binding. My compose file is very simple, but it only makes the dashboard available at localhost:8080 and not traefik.localhost.

version: '3.8'

services:
  traefik:
    restart: always
    container_name: traefik
    image: traefik:latest
    command:
      - --api.insecure=true
      - --api.dashboard=true
      - --log.level=DEBUG
      - --providers.docker=true
      - --providers.docker.exposedbydefault=false
      - --providers.docker.network=web
      - --entrypoints.web.address=:80
    labels:
      - "traefik.enable=true"
      - "traefik.http.services.traefik.loadbalancer.server.port=8080"
      - "traefik.http.routers.api.rule=Host(`traefik.localhost`)"
      - "traefik.http.routers.api.service=api@internal"
      - "traefik.http.routers.api.entryPoints=web"
    ports:
      - '80:80'
      - '8080:8080'
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    networks:
      - web

networks:
  web:
    driver: bridge

What am I doing wrong here? Any help is appreciated, thanks!

Don’t use api.insecure=true (doc).

Check simple Traefik example.

Thank you but the error turned out to be something related to my system. Hosting anything on localhost does not work, even when added to the hosts file. Hosting on a "devel" address worked!

You should be able to use localhost or subdomain.localhost without a problem.

The only challenge is that you can’t use LE certs, as validation can’t be done.