During development, each time the docker stack starts, a new self-signed certificate is generated. It prompts security warnings on each client application that tries to use them.
I would like to store the self-signed certificate on a volume, so that for each upcoming docker-compose the same certificate would be used.
My current configuration:
# http.yml - self-signed
http:
routers:
to-http-to-https:
rule: "Host(`localhost`)"
service: nginx
tls: {}
As you can see a new certificate is generated each time.
For Let's Encrypt certificates, I set up a resolver with a storage path. But how to do the same for an auto-generated and self-signed certificate?
Here an example of Let's Encrypt configuration that stores the certificate inside a json file:
# http.yml - acme
http:
routers:
to-http-to-https:
rule: "Host(`localhost`)"
service: nginx
tls:
certResolver: myresolver
# traefik.yaml - acme
certificatesResolvers:
myresolver:
acme:
email: ...
storage: /my-storage-location/acme.json
caServer: ...
# caServer: ...
tlsChallenge: {}