tiangolo / dockerswarm.rocks

Docker Swarm mode rocks! Ideas, tools and recipes. Get a production-ready, distributed, HTTPS served, cluster in minutes, not weeks.

Home Page:https://dockerswarm.rocks/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom SSL Certificate

cristianbauza opened this issue · comments

It would be very useful to have a chapter that explains how to configure a custom wildcard type certificate. Tanks.

Thanks for the patience!

I should let you know, I had to deprecate this website and ideas, I would no longer recommend Docker Swarm Mode for new projects: https://dockerswarm.rocks/swarm-or-kubernetes/ 🥲

My solution for custom wildcard certificates was to mount two volumes in the traefik container, one to read a dynamic configuration file and one to read the certificates stored locally:

command:
  - --providers.file.directory=/etc/traefik/
  - --providers.file.watch=true

volumes:
  - "./config/dynamic.yml:/etc/traefik/dynamic.yml:ro"
  - "./certs:/etc/certs:ro"

Dynamic.yml

tls:
  certificates:
    - certFile: "/etc/certs/local-cert.pem"
      keyFile: "/etc/certs/local-key.pem"

If there's issues with deploying the custom certificates, check the docker logs for the traefik container, as traefik will fallback to the default (inbuilt) certificates if there's a problem.