How to make docker configuration global?

I am converting my Caddy reverspe proxy to Traefik and Traefik Docker Routing Documentation - Traefik has detailed information about how to set stuff at the container level.

Is there a general way to convert these container level configuration to a global one?

Some examples would be

  • traefik.http.routers.dash.rule=Host(dash.swtk.eu) → could be global because all my hosts are <docker service name>.swtk.eu
  • traefik.enable=true but for all the containers (this one I know because I found it somewhere but I wanted to give some generic examples)
  • traefik.http.routers.dash.middlewares=authelia@docker → a middleware applied to all the containers

For the last example, I would also like to be able to change this on a per-container basis, but I guess that it would be traefik.http.routers.dash.middlewares=

Is there a general documentation for such "local to global" syntax?

Most global config would be set on entrypoint or provider, so check the docs (1, 2) and reference.

You don’t even need traefik.enable=true if you don’t set exposedByDefault=false.

Thank you.

I knew that one but wanted to provide examples that cover my use cases. My ultimate goal is to not have labels on containers for generic configuration, and only have exceptions or specific cases as labels.

Yeah, I understand the goal. You can even provide a default rule.

I am happy with reduced labels. Exceptions are hard, if you assign a middleware globally, you can't remove it for a single service.

Yes, I noticed that but I expect to have middleware that can fortunately be configured themselves for exceptions (such as Authelia).

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