Traefik with SSL Certificate in a Docker Swarm

Install Docker Swarm by following my guide.

Create a network for Traefik, config and secrets for storing the Traefik configuration, certificate and key on the Docker Swarm manager node before applying the configuration.

Create a network for Traefik using the command:

docker network create -d overlay traefik-network

Create a secret for storing the certificate using the command:

docker secret create wildcard-heyvaldemar-net.crt /path/to/wildcard-heyvaldemar-net.crt

Create a secret for storing the key using the command:

docker secret create wildcard-heyvaldemar-net.key /path/to/wildcard-heyvaldemar-net.key

Create a config for storing the Traefik configuration using the command:

docker config create traefik-dynamic-configuration.yml /path/to/traefik-dynamic-configuration.yml

Example of traefik-dynamic-configuration.yml:

tls:
  certificates:
    - certFile: /run/secrets/wildcard-heyvaldemar-net.crt
      keyFile: /run/secrets/wildcard-heyvaldemar-net.key

Deploy Traefik in a Docker Swarm using the command:

docker stack deploy -c traefik-ssl-certificate-docker-swarm.yml traefik

Author

hey, I’m Vladimir Mikhalev, but my friends call me Valdemar.

🌐 My website with detailed IT guides
🎬 Follow me on YouTube
🐦 Follow me on Twitter
🎨 Follow me on Instagram
🎸 Follow me on Facebook
🎥 Follow me on TikTok
💻 Follow me on LinkedIn
🐈 Follow me on GitHub

Communication

👾 Chat with IT pros on Discord
📧 Reach me at ask@sre.gg

Give Thanks

💎 Support on GitHub
🏆 Support on Patreon
🥤 Support on BuyMeaCoffee
🍪 Support on Ko-fi
💖 Support on PayPal