Configure user defined TLS directly in the docker compose (Portainer stack)


actually I'm trying to configure my traefik to use my existing certificates (provided via docker volume). For that I have found the doc for user defined tls. There are two file examples (YAML & TOML). Is it possible, instead of using such config files to configure it directly in the compose file?
I'm using portainer and provides different stacks, that can I simply reach via web browser.

If someone can provide me a link to an example or can describe, how to do it, would be really nice :slight_smile:

Thank you!


It is not currently not possible to configure custom TLS cert files via provider.docker.

You need to use provider.file to load a dynamic configuration file. I know your pain, we use Docker Swarm and it's an extra file to manage, really not fitting into the single file docker-compose.yml concept.

Docker Swarm provides configs and secrets to make additional files availabale on all nodes, that works for us. But you can't simply update them, so on every cert renew we need to tear down and re-create our whole Traefik stack, leading to a short service interruption.

There is a really dirty hack to still get it working: overwrite the Traefik container command to first create the file and then execute the original Traefik command. Really hacky example for certbot. But I would not recommend this.

1 Like

Thank you for your response. It's a pitty, that there is not another way to configure it. So I'm also using the provider.file variant.

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