How to avoid regenerating certs each time to restart Traefik?

Hello all,

For example, I have a docker-compose.yml and I have to restart each time, but I have defined Let's Encrypt.

Each I restarted, Traefik tries to regenerate certs causing an overflow to Let's Encrypt and you cannot generate more certs for all domains defined in docker-compose.

Hello,

what I did was to store the generated certificates in a docker volume, and traefik seems to be checking their validity before trying to re-generate them.

excerpts from my docker-compose.yml that matches this:

version: '3.6'

volumes:
   traefik-letsencrypt:

services:
  traefik:
    image: traefik:latest
    container_name: "traefik"
    command:
#[...]
        # DNS Challenge (domain.tld and *.domain.tld DNS zones are defined there)  
      #- "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
      - --certificatesresolvers.myresolver.acme.email=postmaster@${SERVER_HOSTNAME}
      - --certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json
      - --certificatesresolvers.myresolver.acme.dnschallenge=true
      - --certificatesresolvers.myresolver.acme.dnschallenge.delaybeforecheck=0
#[...]
    volumes:
      - traefik-letsencrypt:/letsencrypt
#[...]

Hope it helps !

1 Like

Yes! you're right! thanks :smiley:

I found here too Let's Encrypt - Traefik

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.