Non-existent resolver: using docker + letsencrypt in static config

There is a certificate resolver defined in the static config, but it so not found in the dynamic docker config:

level=error msg="the router testr uses a non-existent resolver: le"

Here comes a somehow minimal example: the static config traefik.yml:

entryPoints:
  web:
    address: ':80'
  web-secure:
    address: ':443'
  traefik:
    address: ':8080'

providers:
  docker:
    watch: true
    exposedByDefault: false

api:
  insecure: true
  dashboard: true
  debug: true

certificateResolvers:
  le:
    acme:
      email: daniel@sbgg.ac.at
      storage: /var/lib/letsencrypt/acme.json
      httpChallenge:
        entryPoint: web
      domains:
        - main: something.sbgg.ac.at

log:
  level: DEBUG

Here the full docker-compose:

version: '3'

services:
  traefik:
    image: traefik:v2.0.5
    ports:
    - 80:80
    - 443:443
    - 8080:8080  # traefik GUI
    volumes:
    - /var/run/docker.sock:/var/run/docker.sock
    - ./traefik.yml:/etc/traefik/traefik.yml
    - /srv/data/letsencrypt:/var/lib/letsencrypt/
    restart: always
    networks:
      - webgateway
      
  nginx:
    image: nginx
    ports:
      - 8000:80  # need this
    volumes:
      - /home/user/html/:/usr/share/nginx/html:ro
    restart: always
    labels:
      # traefik basic
      - "traefik.enable=true"
      - "traefik.docker.network=webgateway"
      # traefik actual router
      - "traefik.http.routers.testr.entrypoints=web-secure"
      - "traefik.http.routers.testr.rule=PathPrefix(`/me`)"
      - "traefik.http.routers.testr.tls=true"
      - "traefik.http.routers.testr.tls.certresolver=le"
      # traefik service
      - "traefik.http.services.tests.loadbalancer.server.port=8000"

networks:
  webgateway:
    driver: bridge

I have no idea why it doesn't work. Any suggestions?

(This might be related to Non-existent resolver error with letsencrypt, docker-swarm and traefik v2 but the poster there seems to have something working now.)

Hi @dkrenn, there is a typo in your traefik.yml: change certificateResolvers to certificatesResolvers (plural form for the word "certificate").

If it can help further, you can check the reference documentation at any time: https://docs.traefik.io/v2.0/reference/static-configuration/file/ (there is a YAML tab).

1 Like

Hello,

also:

  • domains cannot be set the certificatesResolvers section.
  • - "traefik.http.services.tests.loadbalancer.server.port=8000" must be - "traefik.http.services.tests.loadbalancer.server.port=80" on your nginx container.
2 Likes

Thank you a lot. (Didn't catch this typo, although reading through it a lot.)

domains cannot be set the certificatesResolvers section.

Can I set this somewhere else in the static config? (only found the way to specify Host(...) in the dynamic docker config, which I do not want as I need this configuration to be independent of the particular host as it is used on different systems.)

It's in the dynamic configuration https://docs.traefik.io/v2.0/routing/routers/#domains

really? In the docker-compose.yml there is

nginx:
    ports:
      - 8000:80  # need this

so I thought port 80 is only inside the container and 8000 is from outside, and that traefik needs to use the port where the container can accessed to and that is the outside port 8000. Am I wrong here?

So, does this imply that there is no way anymore to specify the domain in the static config (like this was the case in traefik:1.7)?

Traefik uses the port inside the container, you don't need to expose it

1 Like

Traefik, would benefit from a config linter, or a log mode where non-existent config values are warned about. There is decent number of issues when stuff is not working because of typo, and traefik silently ignores it.

The workaround currently is to look in the logs the configuration that is dumped there and then compare it with what was provided, it works, but it would be simpler and nicer if there was a mode where traefik would warn about these instances.

1 Like

I was facing same problem.. Thank you guys for the solution.