Docker-compose.yml & traefik.toml

Hi !

I am totally new with traefik.
I started to work with the v2 and read the doc.

I keep thinking that something is unclear in my head :

So I have a ubuntu 18.04 host, I dockerized traefik with docker-compose.
In this yml, I have put 3 services : traefik, watchtower and portainer. For information, here is the link to this file : https://gist.github.com/mTrax-/9d05d54c0c8bea3cf67fa68156914007
This code works (I am not sure if it should, but it does) and I can access to portainer and traefik dashboard.

I am scratching my head because I am trying to route traffic from traefic to a host outside docker. And all examples that I found are related to the previous version of traefic with toml files.

What I mean is : I am not sure if what I've done is correct (embed everything in the same yaml file) and if there is a way to achieve this without a toml file.
You can see that my last try was with a router & service to a host outside the bridge created automatically by compose. It doesn't work.

Thinking that it doesn't work because of the network, I have tried to put everything on the physical network with a macvlan driver but it didn't worked either.

Well, my last try (that I have not done yet) will be to use the traefik.toml configuration to link to a backend/frontend but I don't like that because it seems completely not the way to go when routers & services have been created to replace these.

Any advice or remarks to clarify what I do not understand ?

Thanks !

I am currently in the same position, Everything docker container related is working fine with the docker-compose.yml method but there doesn't appear to be a way to define external services.

traefik.http.services.website_service.loadbalancer.server.url

does not appear to be a valid label, only .port is. I wonder if this functionality will be added later or not and if we should just convert our provider from docker to file.

Hello,

Instead of:

      # test redirect to a host outside docker
      - traefik.http.routers.website_router.rule=Host(`website.domain.tld`)
      - traefik.http.routers.website_router.entrypoints=websecure
      - traefik.http.routers.website_router.tls.certresolver=leresolver
      - traefik.http.routers.website_router.service=sonarr_service
      - traefik.http.services.website_service.loadbalancer.server.url=http://ip_on_host_network
      - traefik.http.services.website_service.loadbalancer.server.port=website_port

you have to use the file provider:

http:
  routers:
    website_router:
      rule: Host(`website.domain.tld`)
      entrypoints: websecure
      tls:
        certresolver: leresolver
      service: sonarr_service

  services:
    website_service:
      loadbalancer:
        server:
          - url: http://ip_on_host_network

https://docs.traefik.io/v2.0/providers/file/