# Docker-compose.yml & traefik.toml

**URL:** <https://community.traefik.io/t/docker-compose-yml-traefik-toml/2334>\
**Category:** Traefik v2\
**Tags:** file\
**Created:** [October 13, 2019, 8:03pm UTC](https://community.traefik.io/t/docker-compose-yml-traefik-toml/2334 "2019-10-13T20:03:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mTrax](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@mTrax](https://community.traefik.io/u/mTrax)\
**Post date:** [October 13, 2019, 8:03pm UTC](https://community.traefik.io/t/docker-compose-yml-traefik-toml/2334/1 "2019-10-13T20:03:08Z")

</div>

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](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 !

---

<div class="post-metadata">

**Author:** ![Universal](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/universal/32/921_2.png) [@Universal](https://community.traefik.io/u/Universal)\
**Post date:** [October 14, 2019, 5:50pm UTC](https://community.traefik.io/t/docker-compose-yml-traefik-toml/2334/2 "2019-10-14T17:50:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ldez](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/ldez/32/5_2.png) [@ldez](https://community.traefik.io/u/ldez)\
**Post date:** [October 14, 2019, 7:03pm UTC](https://community.traefik.io/t/docker-compose-yml-traefik-toml/2334/3 "2019-10-14T19:03:42Z")

</div>

Hello,

Instead of:

```auto
      # 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:

```auto
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/](https://docs.traefik.io/v2.0/providers/file/)
