# How do i add external service using labels/command?

**URL:** <https://community.traefik.io/t/how-do-i-add-external-service-using-labels-command/17296>\
**Category:** Traefik v2\
**Tags:** docker\
**Created:** [January 26, 2023, 8:45pm UTC](https://community.traefik.io/t/how-do-i-add-external-service-using-labels-command/17296 "2023-01-26T20:45:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![AnderssonPeter](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/anderssonpeter/32/6558_2.png) [@AnderssonPeter](https://community.traefik.io/u/AnderssonPeter)\
**Post date:** [January 26, 2023, 8:45pm UTC](https://community.traefik.io/t/how-do-i-add-external-service-using-labels-command/17296/1 "2023-01-26T20:45:52Z")

</div>

Hi I'm running Traefik 2.9.6 using docker-compose.

How do I add a remote/external (not hosted on the same docker host) service using labels/commands?

I tried to add the following labels to the traefik container but that didn't work

```plaintext
- "traefik.enable=true"
- "traefik.http.routers.test.rule=Host(`test.localhost`)"
- "traefik.http.routers.test.service=test"
- "traefik.http.services.test.loadbalancer.server.ip=192.168.10.15"
- "traefik.http.services.test.loadbalancer.server.port=5568"

```

When I start Traefik and look in the dashboard it dosen't seem to find the `test` service.

---

<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 27, 2023, 12:29am UTC](https://community.traefik.io/t/how-do-i-add-external-service-using-labels-command/17296/2 "2023-01-27T00:29:02Z")

</div>

Would you mind sharing your full Traefik static and dynamic config, and `docker-compose.yml` if used?

You should probably use [.url](https://doc.traefik.io/traefik/routing/services/#servers-load-balancer). Do you have `provider.docker` enabled to read the labels?

---

<div class="post-metadata">

**Author:** ![AnderssonPeter](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/anderssonpeter/32/6558_2.png) [@AnderssonPeter](https://community.traefik.io/u/AnderssonPeter)\
**Post date:** [January 27, 2023, 8:38am UTC](https://community.traefik.io/t/how-do-i-add-external-service-using-labels-command/17296/3 "2023-01-27T08:38:02Z")

</div>

I don't have any other config excluding my `command` section.

```plaintext
  traefik:
    image: "traefik:${TRAEFIK_VERSION}"
    container_name: "traefik"
    restart: unless-stopped
    read_only: true
    mem_limit: 2G
    cpus: 0.75
    security_opt:
      - no-new-privileges:true
    command:
      - "--log.level=DEBUG"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      # Logs
      - --accesslog.filepath=/logs/access.log
      - --accesslog.format=json
      - --accesslog.fields.defaultMode=keep
      - --accesslog.fields.headers.defaultMode=keep
      - --log.filepath=/logs/traefik.log
      #- --log.format=json
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.test.rule=Host(`test.localhost`)"
      - "traefik.http.routers.test.service=test"
      - "traefik.http.services.test.loadbalancer.server.ip=192.168.10.15"
      - "traefik.http.services.test.loadbalancer.server.port=5568"
    environment:
      - TZ=Europe/Stockholm
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    volumes:
      - ./traefik/logs:/logs

```

---

<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 27, 2023, 12:33pm UTC](https://community.traefik.io/t/how-do-i-add-external-service-using-labels-command/17296/4 "2023-01-27T12:33:39Z")

</div>

> [@AnderssonPeter](#):
>
> `.loadbalancer.server.ip=192.168.10.15`

Did you see my comment regarding `.url`? You should try

```auto
.loadbalancer.server.url=http://192.168.10.15

```

**Update** : Seems you can't use `.loadbalancer.server.url` in labels, so you need to create a dynamic config file with [loadbalancer](https://doc.traefik.io/traefik/routing/services/#load-balancing) and load that file via `provider.file` in your static config.

---

<div class="post-metadata">

**Author:** ![AnderssonPeter](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/anderssonpeter/32/6558_2.png) [@AnderssonPeter](https://community.traefik.io/u/AnderssonPeter)\
**Post date:** [January 27, 2023, 12:41pm UTC](https://community.traefik.io/t/how-do-i-add-external-service-using-labels-command/17296/5 "2023-01-27T12:41:33Z")

</div>

Thanks that explains why it didn't even show up in the ui or the logs!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/bd81ebdb578656e76e56ff3cc3eed021d3ba132d.png) [@system](https://community.traefik.io/u/system)\
**Post date:** [January 30, 2023, 12:42pm UTC](https://community.traefik.io/t/how-do-i-add-external-service-using-labels-command/17296/6 "2023-01-30T12:42:30Z")

</div>

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
