# TCP router + service configuration in dynamic file

**URL:** <https://community.traefik.io/t/tcp-router-service-configuration-in-dynamic-file/21143>\
**Category:** Traefik v2\
**Tags:** tcp, docker\
**Created:** [January 20, 2024, 12:20am UTC](https://community.traefik.io/t/tcp-router-service-configuration-in-dynamic-file/21143 "2024-01-20T00:20:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mlanner](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/mlanner/32/8121_2.png) [@mlanner](https://community.traefik.io/u/mlanner)\
**Post date:** [January 20, 2024, 12:20am UTC](https://community.traefik.io/t/tcp-router-service-configuration-in-dynamic-file/21143/1 "2024-01-20T00:20:42Z")

</div>

I know I can use a label inside of a compose file, as follows:

```auto
- "traefik.tcp.services.myservice.loadbalancer.server.port=123"

```

If I wanted to instead put it in a dynamic `config.yml` file, how would I do it? I've tried a variety of options, like (maybe the obvious):

```auto
tcp:
  services:
    myservice:
      loadBalancer:
        server:
          port: 123

```

I've also tried:

```auto
tcp:
  services:
    myservice:
      loadBalancer:
        servers:
          - address: 'tcp://myservice:123'

```

... and a variety of other takes on similar configs, but have yet to be successful

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [January 20, 2024, 9:19am UTC](https://community.traefik.io/t/tcp-router-service-configuration-in-dynamic-file/21143/2 "2024-01-20T09:19:28Z")

</div>

Here is the example from the [Traefik TCP service doc](https://doc.traefik.io/traefik/routing/services/#configuring-tcp-services), address is only IP:

```auto
## Dynamic configuration
tcp:
  services:
    my-service:
      loadBalancer:
        servers:
        - address: "xx.xx.xx.xx:xx"
        - address: "xx.xx.xx.xx:xx"

```

Note that you also need a TCP `router`.

For use with labels, check [simple Traefik TCP example](https://github.com/bluepuma77/traefik-best-practice/tree/main/docker-traefik-tcp).

---

<div class="post-metadata">

**Author:** ![mlanner](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/mlanner/32/8121_2.png) [@mlanner](https://community.traefik.io/u/mlanner)\
**Post date:** [January 24, 2024, 8:08pm UTC](https://community.traefik.io/t/tcp-router-service-configuration-in-dynamic-file/21143/3 "2024-01-24T20:08:22Z")

</div>

@bluepuma77,

Yep, removing the `tcp://` in my `- address:` line sorted this out for me. Using the internal name resolution inside of my docker network allowed me to address it as:

```auto
servers:
  - address: "myservice:123"

```

At least it's now working more like I anticipated it to. I'm still fighting some issues with the container I'm using, but I don't think that has anything to do with Traefik itself, but rather the container setup and its requirements.
