Error: the router dashboard@docker uses a non-existent resolver: leresolver

Greetings

I've set up a first docker box with Traefik v2 and it's working. After setting up a second docker box, I wanted to install Traefik there too. So I've copied the docker-compose file, but LE doesn't work, I see that in the log:

the router dashboard@docker uses a non-existent resolver: leresolver

The resolver is configured exactly the same way it is on the first box:

    command:
      - --log.level=DEBUG
      - --providers.docker
      - --api=true
      - --api.dashboard=true
      - --entrypoints.web.address=:80
      - --entrypoints.websecure.address=:443
      - --providers.docker.exposedbydefault=false
      - --certificatesresolvers.leresolver.acme.email=email@gmail.com
      - --certificatesresolvers.leresolver.acme.storage=/data/letsencrypt/acme.json
      - --certificatesresolvers.leresolver.acme.tlschallenge=true

and the labels are the also the same (except of course the hostname):

    labels:
      - traefik.enable=true
      - "traefik.http.routers.dashboard.rule=(PathPrefix(`/api`) || PathPrefix(`/dashboard`)) && Host(`hostname.tld`)"
      - "traefik.http.routers.dashboard.service=api@internal"
      - traefik.http.routers.dashboard.tls.certresolver=leresolver
      - traefik.http.routers.dashboard.entrypoints=websecure

What am I doing wrong??

Thanks in advance

Regards

Hello,

Could you provide more information (full traefik section of your docker-compose, and logs).

compose file:

version: '2'

services:
  reverse-proxy:
    image: traefik:latest
    container_name: traefik
    command:
      - --log.level=DEBUG
      - --providers.docker
      - --api=true
      - --api.dashboard=true
      - --entrypoints.web.address=:80
      - --entrypoints.websecure.address=:443
      - --providers.docker.exposedbydefault=false
      - --certificatesresolvers.leresolver.acme.email=email@gmail.com
      - --certificatesresolvers.leresolver.acme.storage=/data/letsencrypt/acme.json
      - --certificatesresolvers.leresolver.acme.tlschallenge=true
      - --accesslog=true
      - --accesslog.filepath=/logs/traefik_access.log
      - --accesslog.format=json
    restart: unless-stopped
    ports:
      - "80:80"
      - 443:443
    labels:
      - traefik.enable=true
      - "traefik.http.routers.dashboard.rule=(PathPrefix(`/api`) || PathPrefix(`/dashboard`)) && Host(`hostname.tld`)"
     - "traefik.http.routers.dashboard.service=api@internal"
      - traefik.http.routers.dashboard.tls=true
      - traefik.http.routers.dashboard.tls.certresolver=leresolver
      - traefik.http.routers.dashboard.entrypoints=websecure
      - "traefik.http.routers.dashboard.middlewares=auth"

      - "traefik.http.middlewares.auth.basicauth.users=blahblablah"
      - "traefik.http.middlewares.auth.basicauth.removeheader=true"

      # global redirect to https
      - traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)
      - traefik.http.routers.http-catchall.entrypoints=web
      - traefik.http.routers.http-catchall.middlewares=redirect-to-https
      # middleware redirect
      - traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https
      # auth
      - "traefik.http.middlewares.password_auth.basicauth.users=blahblablah"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - traefik_data:/data
      - traefik_logs:/logs
#      - /home/docker/traefik/traefik.toml:/etc/traefik/traefik.toml
    networks:
      - traefik_default


volumes:
  traefik_data:
    external: true
  traefik_logs:
    external: true

networks:
  traefik_default:
    external:
      name: traefik_default

logs:

# docker-compose up                                                                                                                                                                                                                               
Starting traefik ... done                                                                                                                                                                                                                                                        
Attaching to traefik                                                                                                                                                                                                                                                             
traefik          | time="2020-01-23T16:28:44Z" level=info msg="Configuration loaded from flags."                                                                                                                                                                                 
traefik          | time="2020-01-23T16:28:44Z" level=info msg="Traefik version 2.1.3 built on 2020-01-21T17:30:29Z"                                                                                                                                                              
traefik          | time="2020-01-23T16:28:44Z" level=debug msg="Static configuration loaded {\"global\":{\"checkNewVersion\":true},\"serversTransport\":{\"maxIdleConnsPerHost\":200},\"entryPoints\":{\"web\":{\"address\":\":80\",\"transport\":{\"lifeCycle\":{\"graceTimeOut\"
:10000000000},\"respondingTimeouts\":{\"idleTimeout\":180000000000}},\"forwardedHeaders\":{}},\"websecure\":{\"address\":\":443\",\"transport\":{\"lifeCycle\":{\"graceTimeOut\":10000000000},\"respondingTimeouts\":{\"idleTimeout\":180000000000}},\"forwardedHeaders\":{}}},\"p
roviders\":{\"providersThrottleDuration\":2000000000,\"docker\":{\"watch\":true,\"endpoint\":\"unix:///var/run/docker.sock\",\"defaultRule\":\"Host(`{{ normalize .Name }}`)\",\"swarmModeRefreshSeconds\":15000000000}},\"api\":{\"dashboard\":true},\"log\":{\"level\":\"DEBUG\"
,\"format\":\"common\"},\"accessLog\":{\"filePath\":\"/logs/traefik_access.log\",\"format\":\"json\",\"filters\":{},\"fields\":{\"defaultMode\":\"keep\",\"headers\":{\"defaultMode\":\"drop\"}}},\"certificatesResolvers\":{\"leresolver\":{\"acme\":{\"email\":\"email@gmail.
com\",\"caServer\":\"https://acme-v02.api.letsencrypt.org/directory\",\"storage\":\"/data/letsencrypt/acme.json\",\"keyType\":\"RSA4096\",\"tlsChallenge\":{}}}}}"                                                                                                               
traefik          | time="2020-01-23T16:28:44Z" level=info msg="\nStats collection is disabled.\nHelp us improve Traefik by turning this feature on :)\nMore details on: https://docs.traefik.io/v2.0/contributing/data-collection/\n"                                            
traefik          | time="2020-01-23T16:28:44Z" level=error msg="Unable to add ACME provider to the providers list: unable to get ACME account: open /data/letsencrypt/acme.json: no such file or directory"                                                                      
traefik          | time="2020-01-23T16:28:44Z" level=info msg="Starting provider aggregator.ProviderAggregator {}"                                                                                                                                                               
traefik          | time="2020-01-23T16:28:44Z" level=debug msg="Start TCP Server" entryPointName=websecure                                                                                                                                                                       
traefik          | time="2020-01-23T16:28:44Z" level=debug msg="Start TCP Server" entryPointName=web                                                                                                                                                                             
traefik          | time="2020-01-23T16:28:44Z" level=info msg="Starting provider *traefik.Provider {}"                                                                                                                                                                           
traefik          | time="2020-01-23T16:28:44Z" level=info msg="Starting provider *docker.Provider {\"watch\":true,\"endpoint\":\"unix:///var/run/docker.sock\",\"defaultRule\":\"Host(`{{ normalize .Name }}`)\",\"swarmModeRefreshSeconds\":15000000000}"                       
traefik          | time="2020-01-23T16:28:44Z" level=debug msg="Configuration received from provider internal: {\"http\":{\"services\":{\"api\":{},\"dashboard\":{}}},\"tcp\":{},\"tls\":{}}" providerName=internal                                                              
traefik          | time="2020-01-23T16:28:44Z" level=debug msg="No default certificate, generating one"                                                                                                                                                                          
traefik          | time="2020-01-23T16:28:44Z" level=debug msg="Provider connection established with docker 19.03.5 (API 1.40)" providerName=docker                                                                                                                              
traefik          | time="2020-01-23T16:28:44Z" level=debug msg="Filtering disabled container" container=weave-8eabc3154a799716ffe622192769c2c15a48d9fdd05a478a9044a07f4839490f providerName=docker                                                                               
traefik          | time="2020-01-23T16:28:44Z" level=debug msg="Configuration received from provider docker: {\"http\":{},\"tcp\":{}}" providerName=docker       
               traefik          | time="2020-01-23T16:28:44Z" level=debug msg="Provider event received {Status:start ID:0028668e72e5989f50747ba1abfb91c9b4438dd1b56b085843c44c884548048c From:traefik:latest Type:container Action:start Actor:{ID:0028668e72e5989f50747ba1abfb91c9b4438d[0/1173]
5843c44c884548048c Attributes:map[com.docker.compose.config-hash:44c833d376fa2ac2247bfce43cd40ca1ba24e85c7b83c34ed0e46f9e8bec6960 com.docker.compose.container-number:1 com.docker.compose.oneoff:False com.docker.compose.project:traefik com.docker.compose.service:reverse-prox
y com.docker.compose.version:1.21.0 image:traefik:latest name:traefik org.opencontainers.image.description:A modern reverse-proxy org.opencontainers.image.documentation:https://docs.traefik.io org.opencontainers.image.title:Traefik org.opencontainers.image.url:https://traef
ik.io org.opencontainers.image.vendor:Containous org.opencontainers.image.version:v2.1.3 traefik.enable:true traefik.http.middlewares.auth.basicauth.removeheader:true traefik.http.middlewares.auth.basicauth.users:...traefik.http.middl
ewares.password_auth.basicauth.users:... traefik.http.middlewares.redirect-to-https.redirectscheme.scheme:https traefik.http.routers.dashboard.entrypoints:websecure traefik.http.routers.dashboard.middlewares:auth traefik.http.routers.d
ashboard.rule:(PathPrefix(`/api`) || PathPrefix(`/dashboard`)) && Host(`hostname.tld`) traefik.http.routers.dashboard.service:api@internal traefik.http.routers.dashboard.tls:true traefik.http.routers.dashboard.tls.certresolver:leresolver traefik.http.routers.http-catchall
.entrypoints:web traefik.http.routers.http-catchall.middlewares:redirect-to-https traefik.http.routers.http-catchall.rule:hostregexp(`{host:.+}`)]} Scope:local Time:1579796924 TimeNano:1579796924232511929}" providerName=docker
traefik          | time="2020-01-23T16:28:44Z" level=debug msg="Filtering disabled container" providerName=docker container=weave-8eabc3154a799716ffe622192769c2c15a48d9fdd05a478a9044a07f4839490f
traefik          | time="2020-01-23T16:28:44Z" level=debug msg="Configuration received from provider docker: {\"http\":{\"routers\":{\"dashboard\":{\"entryPoints\":[\"websecure\"],\"middlewares\":[\"auth\"],\"service\":\"api@internal\",\"rule\":\"(PathPrefix(`/api`) || Path
Prefix(`/dashboard`)) \\u0026\\u0026 Host(`hostname.tld`)\",\"tls\":{\"certResolver\":\"leresolver\"}},\"http-catchall\":{\"entryPoints\":[\"web\"],\"middlewares\":[\"redirect-to-https\"],\"service\":\"reverse-proxy-traefik\",\"rule\":\"hostregexp(`{host:.+}`)\"}},\"middl
ewares\":{\"auth\":{\"basicAuth\":{\"users\":[\"...\"],\"removeHeader\":true}},\"password_auth\":{\"basicAuth\":{\"users\":[\"...\"]}},\"redirect-to-https\":{\"redirectScheme\":{\"scheme\":\"https
\"}}},\"services\":{\"reverse-proxy-traefik\":{\"loadBalancer\":{\"servers\":[{\"url\":\"http://172.20.0.2:80\"}],\"passHostHeader\":true}}}},\"tcp\":{}}" providerName=docker
traefik          | time="2020-01-23T16:28:44Z" level=debug msg="No default certificate, generating one"
traefik          | time="2020-01-23T16:28:46Z" level=debug msg="Creating middleware" routerName=http-catchall@docker serviceName=reverse-proxy-traefik middlewareType=Pipelining middlewareName=pipelining entryPointName=web
traefik          | time="2020-01-23T16:28:46Z" level=debug msg="Creating load-balancer" entryPointName=web routerName=http-catchall@docker serviceName=reverse-proxy-traefik
traefik          | time="2020-01-23T16:28:46Z" level=debug msg="Creating server 0 http://172.20.0.2:80" entryPointName=web routerName=http-catchall@docker serviceName=reverse-proxy-traefik serverName=0
traefik          | time="2020-01-23T16:28:46Z" level=debug msg="Added outgoing tracing middleware reverse-proxy-traefik" routerName=http-catchall@docker middlewareName=tracing middlewareType=TracingForwarder entryPointName=web
traefik          | time="2020-01-23T16:28:46Z" level=debug msg="Creating middleware" middlewareName=redirect-to-https@docker entryPointName=web routerName=http-catchall@docker middlewareType=RedirectScheme
traefik          | time="2020-01-23T16:28:46Z" level=debug msg="Setting up redirection to https " entryPointName=web routerName=http-catchall@docker middlewareType=RedirectScheme middlewareName=redirect-to-https@docker
traefik          | time="2020-01-23T16:28:46Z" level=debug msg="Adding tracing to middleware" entryPointName=web routerName=http-catchall@docker middlewareName=redirect-to-https@docker
traefik          | time="2020-01-23T16:28:46Z" level=debug msg="Creating middleware" middlewareType=Recovery entryPointName=web middlewareName=traefik-internal-recovery
traefik          | time="2020-01-23T16:28:46Z" level=debug msg="Added outgoing tracing middleware api@internal" middlewareType=TracingForwarder entryPointName=websecure routerName=dashboard@docker middlewareName=tracing
traefik          | time="2020-01-23T16:28:46Z" level=debug msg="Creating middleware" entryPointName=websecure routerName=dashboard@docker middlewareType=BasicAuth middlewareName=auth@docker
traefik          | time="2020-01-23T16:28:46Z" level=debug msg="Adding tracing to middleware" middlewareName=auth@docker entryPointName=websecure routerName=dashboard@docker
traefik          | time="2020-01-23T16:28:46Z" level=debug msg="Creating middleware" middlewareName=traefik-internal-recovery middlewareType=Recovery entryPointName=websecure
traefik          | time="2020-01-23T16:28:46Z" level=debug msg="No default certificate, generating one"
traefik          | time="2020-01-23T16:28:46Z" level=error msg="the router dashboard@docker uses a non-existent resolver: leresolver"

The root cause:

You have to create /data/letsencrypt

Wow congratulations I'm impressed I would never have guessed that... what isn't this simple empty folder not automatically created?

As a side note, do you know a log viewer which could have outlined this particular line?

Thanks a lot it's working now!

The directories are not created automatically.

To find the log, I just search level=error in your logs in a simple text editor, I don't have a particular log viewer.

I recommend to use the log level INFO (or the default level WARN) during your tests, the log level DEBUG is mainly for the dev purpose.

I improved the error message to be more clear: https://github.com/containous/traefik/pull/6225