But I have a pile of docker services I want to set up and it would be nice to specify this centrally - having a wildcard domain but having to tell each service which domain to use seems inefficient.
The documentation for routers made me write this in my dyncamic config yaml
Can you elaborate, or may be give some examples? Inefficient in which way? If you want traefik to use let's encrypt to generate certificates for your router, you need to specify the certificate resolver (with acme being the only supported type for now). In many cases, your different routers will be matching different domains, so naturally you would want resolvers to generate different certificates. Of course if you decided to use the same wild card certificate, it's up to you and you can do that - traefik supports that. In that case you will need to specify that same certificate to fetch for each router you want this certificated to be used with. This also seems quite natural. Where do you see in-efficiency? If you have any particular measurements e.g. cpu increase or memory usage increase when you do that, please publish your metrics.
Again, not sure I understand. What you showed is traefik configuration, not docker configuration, so naturally you cannot tell docker to use router0, since it's not a concept docker is aware about. You use docker to manage image and containers, and you use traefik for routing.
I'm at a bit of a loss as to what you are tying to achieve.
Traefik v1 will automagically generate valid LE certs for the subdomain. \o/
Now, most of the examples I see for traefik v2 show all of this config done in docker labels (see first code sample in OP above).
Which means if I run 10 different docker services I have to have 10 replicates of this same configuration - that's what I meant by inefficient, more work for me vs writing it once in traefik v1
It's possible to define middleware chains in traefik v2 dynamic config and then call them via docker labels, so calling https redirect to http middleware:
And it looks to me from the routers configuration that I should be able to do similar, so define router as in second code block in OP above, then in the docker service labels section, something of like this:
You can reference an element (router, service, middleware) from a provider (e.g. file, docker,..) to another provider.
We call that provider namespace (myrouter@file, myrouter@docker), so a router defined in Docker can reference a service defined in a file.
But you cannot define a partial element (e.g. a part of a router configuration) in a file to include it in an existing element configuration. (e.g. you cannot merge 2 routers configuration)