Basic config without label usage

Hi,

I'm new to Traefik and trying to set up a basic confi (traefik.domain => dashboard, whoami.domain => docker container)
I'm using Portainer to set up my containers and traefik (v.2.0.4). I don't really like labels and prefer to set a maximum of stuff in traefik.yml

Currently with my conf my routers are not detected at all, so I always get a 404 error.

Here the configuration :

defaultEntryPoints: ["http", "https"]

log:
  level: "DEBUG"

entryPoints:
  http:
    address: ":80"
  https:
    address: ":443"

api:
  dashboard: True
  insecure: True
  debug: True

certificatesResolvers:
  default:
    acme:
      email: "contact@DOMAIN"
      storage: "acme.json"
      dnsChallenge:
          provider: "ovh"

http:
  routers:
    api:
      #rule: PathPrefix(`/api`) || PathPrefix(`/dashboard`)
      rule: "Host(`traefik.thanos.local`)"
      service: api@internal
      middlewares:
        - dash-auth
  middlewares:
    dash-auth:
      basicAuth:
        users:
          - "admin:$apr1$XXXXXXXXXXXXXXXXXXX"
    https-only:
      redirectScheme:
        scheme: https


docker:
  domain: "thanos.local"
  watch: true
  exposedbydefault: true
  network: "traefik_net"

Here my whoami container labels :

            "Labels": {
                "traefik.docker.network": "traefik_net",
                "traefik.http.routers.whoami.entrypoints": "http",
                "traefik.http.routers.whoami.rule": "Host(`whoami.thanos.local`)"
            }

And... :

╰─$ curl http://traefik.thanos.local/api/rawdata     
404 page not found

╰─$ curl http://whoami.thanos.local/            
404 page not found

If I enable insecure API i get :
╰─$ curl http://traefik.thanos.local:8080/api/rawdata
{}

So nothing is found by my traefik container. Both containers are in the same network (bridge driver).
Any idea ? What did I missed ?

Thanks

Hello,

I guess your are trying to convert a Traefik v1 configuration that you have found somewhere.

Because you mixed v1 and v2 configuration.

I recommend to read:

2 Likes