# Does traefik support multiple dynamic files?

**URL:** <https://community.traefik.io/t/does-traefik-support-multiple-dynamic-files/21583>\
**Category:** Traefik v2\
**Tags:** file, docker\
**Created:** [February 22, 2024, 9:55am UTC](https://community.traefik.io/t/does-traefik-support-multiple-dynamic-files/21583 "2024-02-22T09:55:54Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![bryanpedini](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/bryanpedini/32/5662_2.png) [@bryanpedini](https://community.traefik.io/u/bryanpedini)\
**Post date:** [February 22, 2024, 9:55am UTC](https://community.traefik.io/t/does-traefik-support-multiple-dynamic-files/21583/1 "2024-02-22T09:55:54Z")

</div>

Hello, newbe here

I use Traefik in production with docker provider and it works perfectly, autodiscovery with labels and stuff... however...  
I tried spinning up an instance with a dynamic folder and a couple of files because the intent is to place this instace in front of a couple of different VMs with only one public address to the load balancer VM, however it seems that only some (one?) files get loaded (?)

Here is my complete config: [traefik file provider · GitHub](https://gist.github.com/bryanpedini/2995c578ddb8a55c6143a778539907c6)  
And here is the complete output from `docker compose up` and loglevel debug: [traefik logs · GitHub](https://gist.github.com/bryanpedini/0d7f7cd4513ca48b5a55d50e989048c6)

For example, the dashboard does not work.  
`An error occurred during a connection to traefik.example.com. PR_END_OF_FILE_ERROR`  
And in http (not https) it returns a 404 (instead of redirecting every request to https?).

I don't understand...  
Thank you in advance!!

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [February 22, 2024, 5:11pm UTC](https://community.traefik.io/t/does-traefik-support-multiple-dynamic-files/21583/2 "2024-02-22T17:11:59Z")

</div>

Traefik supports one static config (`traefik.yml` or `command:`) and multiple dynamic configs (`providers.file` or via `providers.docker` and `labels`).

Some elements like `entrypoint` and `certresolver` belong into static config, see [simple Traefik example](https://github.com/bluepuma77/traefik-best-practice/tree/main/docker-traefik-dashboard-letsencrypt).

---

<div class="post-metadata">

**Author:** ![bryanpedini](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/bryanpedini/32/5662_2.png) [@bryanpedini](https://community.traefik.io/u/bryanpedini)\
**Post date:** [February 23, 2024, 10:14am UTC](https://community.traefik.io/t/does-traefik-support-multiple-dynamic-files/21583/3 "2024-02-23T10:14:55Z")

</div>

> [@bluepuma77](#):
>
> Some elements like `entrypoint` and `certresolver` belong into static config

That's the thing I don't understand, static vs dynamic, where am I able to put things into a file, where it is strictly necessary to use the command. Because from a documentation standpoint, for every directive there are examples for both CLI (or labels) and file, but not actually specifying which is static config, which is dynamic, and why doesn't the files work...

Thanks.

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [February 23, 2024, 11:44am UTC](https://community.traefik.io/t/does-traefik-support-multiple-dynamic-files/21583/4 "2024-02-23T11:44:17Z")

</div>

Check [Configuration Introduction](https://doc.traefik.io/traefik/getting-started/configuration-overview/) doc.

When in doubt, check the [static reference](https://doc.traefik.io/traefik/reference/static-configuration/overview/) and [dynamic file](https://doc.traefik.io/traefik/reference/dynamic-configuration/file/) or [dynamic Docker labels](https://doc.traefik.io/traefik/reference/dynamic-configuration/docker/) reference.

---

<div class="post-metadata">

**Author:** ![bryanpedini](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/bryanpedini/32/5662_2.png) [@bryanpedini](https://community.traefik.io/u/bryanpedini)\
**Post date:** [February 23, 2024, 1:20pm UTC](https://community.traefik.io/t/does-traefik-support-multiple-dynamic-files/21583/5 "2024-02-23T13:20:00Z")

</div>

> [@bluepuma77](#):
>
> When in doubt, check the [static reference](https://doc.traefik.io/traefik/reference/static-configuration/overview/)

Wait, from the docs, it says the static file and dynamic folder are mutually exclusive and the dynamic folder is preferred. How do I set up the static file provider then when already using the dynamic folder, like in the configuration I posted initially?

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [February 23, 2024, 6:24pm UTC](https://community.traefik.io/t/does-traefik-support-multiple-dynamic-files/21583/6 "2024-02-23T18:24:22Z")

</div>

The content is. `Entrypoints` belong into static, `routers` and `services` into dynamic. See [simple Traefik example](https://github.com/bluepuma77/traefik-best-practice/tree/main/docker-traefik-dashboard-letsencrypt). `Command` is static, `labels` is dynamic.

---

<div class="post-metadata">

**Author:** ![bryanpedini](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/bryanpedini/32/5662_2.png) [@bryanpedini](https://community.traefik.io/u/bryanpedini)\
**Post date:** [February 27, 2024, 9:19am UTC](https://community.traefik.io/t/does-traefik-support-multiple-dynamic-files/21583/7 "2024-02-27T09:19:19Z")

</div>

Thank you @bluepuma77, I have one last unaswered question from the beginning tho, how does one not use `command`? Like, how do I put everything in a file?

To be precise: I would like this instance to be managed entirely by file, not by CLI commands in the `docker-compose.yml`.

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [February 27, 2024, 9:25am UTC](https://community.traefik.io/t/does-traefik-support-multiple-dynamic-files/21583/8 "2024-02-27T09:25:34Z")

</div>

Static config: either placed in `traefik.yml` file or `command` section.

---

<div class="post-metadata">

**Author:** ![bryanpedini](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/bryanpedini/32/5662_2.png) [@bryanpedini](https://community.traefik.io/u/bryanpedini)\
**Post date:** [February 27, 2024, 9:33am UTC](https://community.traefik.io/t/does-traefik-support-multiple-dynamic-files/21583/9 "2024-02-27T09:33:56Z")

</div>

So, can `traefik.yml` coexist with the dynamic config folder? Because that's the issue that's bugging my head, from the docs it seems they're mutually exclusive...

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [February 27, 2024, 10:27am UTC](https://community.traefik.io/t/does-traefik-support-multiple-dynamic-files/21583/10 "2024-02-27T10:27:27Z")

</div>

Yes, they are independent. Static config is read during startup. Dynamic config can change over time, be it files or labels on containers.

I think you can even use a `providers.file` in static config and watch a full directory, which includes `traefik.yml`. It's not "nice", but I have seen many people do that, so there seems to be no issue.

---

<div class="post-metadata">

**Author:** ![bryanpedini](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/bryanpedini/32/5662_2.png) [@bryanpedini](https://community.traefik.io/u/bryanpedini)\
**Post date:** [February 27, 2024, 11:04am UTC](https://community.traefik.io/t/does-traefik-support-multiple-dynamic-files/21583/11 "2024-02-27T11:04:04Z")

</div>

I totally got it wrong then, the `traefik.yml` is where the static configuration goes (if you want to use the file and not CLI or ENV vars), where as the file provider can be either a single file with everything in it, or multiple files in a folder. **THAT's** what mutually exclusive...  
F\* myself, I can't read engrish 🤣

Thank you very much, now everything is much more clear

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/bd81ebdb578656e76e56ff3cc3eed021d3ba132d.png) [@system](https://community.traefik.io/u/system)\
**Post date:** [March 1, 2024, 11:04am UTC](https://community.traefik.io/t/does-traefik-support-multiple-dynamic-files/21583/12 "2024-03-01T11:04:33Z")

</div>

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