How to create static routes using labels or commands

How can I create routes to external services using traefik v2 container label or command settings, not using an external configuration file?

Hi @ptr727
I don't understand exactly what you want to achieve. IMO it's not possible if there not in one of traefik network. you can try - traefik.http.services.my-container-service.loadbalancer.server.url=http://yoururl but it's not sure

Hi @ptr727

The only way i have found this to be possible is by using the file provider to define an external service. The docker provider appears to able to use another service with a router - "traefik.http.routers.router1.service=foobar" if it were define in the file provider you would use foobar@file as service name.

I see, that is unfortunate, I was hoping I could define static services using e.g. commands, similar to how entrypoints are defined.
I build my containers using Ansible, and it is much easier to change the configuration of the container, vs. writing configuration to a file and then mounting the file.

Do you know if there is an open feature request for static routes in commands or labels, if so I'll add my voce of support?