Traefik v2.10 Configuration Issue with Custom SSL Certificate and Docker

Hello,

I'm experiencing an issue with my Traefik (v2.10) setup using Docker. My goal is to set up Traefik to use a custom SSL certificate, but it seems to default to its self-signed certificate instead.

Here are the key parts of my configuration:

Traefik.toml :

[entryPoints]
  [entryPoints.http]
    address = ":80"
  [entryPoints.https]
    address = ":443"

[tls]
  [[tls.certificates]]
    certFile = "/etc/certs/ssl_certificate.cer"
    keyFile = "/etc/certs/private_key.key"
  [tls.stores]
    [tls.stores.default]
      [tls.stores.default.defaultCertificate]
        certFile = "/etc/certs/ssl_certificate.cer"
        keyFile = "/etc/certs/private_key.key"

[api]
#dashboard = true

[providers.docker]
  endpoint = "unix:///var/run/docker.sock"

[providers.file]
  filename = "/etc/traefik/dynamic_conf.yml"

[log]
  level = "DEBUG"

dynamic_config.yml :

http:
  routers:
    dashboard:
      rule: "Host(`traefik.mydomain.fr`)"
      service: "api@internal"
      entryPoints:
        - "https"
      tls: {}

docker-compose.yml :

version: '3.8'
services:
  reverse-proxy:
    image: traefik:v2.10
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /srv/traefik.toml:/etc/traefik/traefik.toml
      - /var/run/docker.sock:/var/run/docker.sock
      - /home/strauss/cert/private_key.key:/etc/certs/private_key.key
      - /home/strauss/cert/ssl_certificate.cer:/etc/certs/ssl_certificate.cer
      - /srv/dynamic_conf.yml:/etc/traefik/dynamic_conf.yml
    labels:
      - "traefik.http.routers.api.rule=Host(`traefik.mydomain.fr`)"
      - "traefik.http.routers.api.service=api@internal"
      - "traefik.http.routers.api.entrypoints=https"
      - "traefik.http.routers.api.middlewares=auth"
      - "traefik.http.middlewares.auth.basicauth.users=myusername:[hashed password]"
      - "traefik.http.routers.api.tls=true"

The issue is that Traefik still uses its default self-signed certificate for traefik.mydomain.fr instead of the custom certificate provided. I've double-checked the paths and the certificate files.

Any suggestions or insights into what I might be missing or doing wrong would be greatly appreciated. Thank you!

Best regards,

TLS is dynamic config, so you need to place it in a dynamic config file, which you load with providers.file in static config.

And you need to enable TLS on the router, as you have done already.