# Using a single Traefik instance to discover multiple Docker hosts

**URL:** <https://community.traefik.io/t/using-a-single-traefik-instance-to-discover-multiple-docker-hosts/12193>\
**Category:** Traefik v2\
**Tags:** docker\
**Created:** [October 21, 2021, 11:53am UTC](https://community.traefik.io/t/using-a-single-traefik-instance-to-discover-multiple-docker-hosts/12193 "2021-10-21T11:53:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![selfhoster195](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/selfhoster195/32/4397_2.png) [@selfhoster195](https://community.traefik.io/u/selfhoster195)\
**Post date:** [October 21, 2021, 11:53am UTC](https://community.traefik.io/t/using-a-single-traefik-instance-to-discover-multiple-docker-hosts/12193/1 "2021-10-21T11:53:08Z")

</div>

Hello.

I'm trying to figure out how to access services locally across containers in multiple Docker hosts.

Currently, I have traefik running on each Docker machine, while a local instance proxies requests to it.

```auto
# Locally-hosted traefik
❯ cat file-provider.yml
http:
  routers:
    vm1:
      rule: "HostRegexp(`{subdomain:[a-z]+}.vm1.net`)"
      service: vm1

  services:
    vm1:
      loadBalancer:
        servers:
          - url: "http://vm1.internal:82"

```

```auto
# vm1.internal traefik
traefik:
  image: traefik
  command:
    - "--api.insecure=true"
    - "--entrypoints.http.address=:80"
    - "--providers.docker.defaultrule=Host(`{{ index .Labels \"com.docker.compose.service\" }}.vm1.net`)"
  ports:
    - 82:80
  volumes:
    - /var/run/docker.sock:/var/run/docker.sock:ro

```

Since there's too many moving parts, I was wondering if it was possible for a single Traefik instance to discover Docker services for multiple specified hosts.

---

<div class="post-metadata">

**Author:** ![cakiwi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/cakiwi/32/3205_2.png) [@cakiwi](https://community.traefik.io/u/cakiwi)\
**Post date:** [October 21, 2021, 12:20pm UTC](https://community.traefik.io/t/using-a-single-traefik-instance-to-discover-multiple-docker-hosts/12193/2 "2021-10-21T12:20:37Z")

</div>

You use an orchestrator such as Docker Swam, Kubernetes, Marathon. If you not keen on that you can leverage a discovery services like etcd, zookeeper, consul.

Traefik works with many of these.

---

<div class="post-metadata">

**Author:** ![kevdog](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/kevdog/32/2825_2.png) [@kevdog](https://community.traefik.io/u/kevdog)\
**Post date:** [October 21, 2021, 2:18pm UTC](https://community.traefik.io/t/using-a-single-traefik-instance-to-discover-multiple-docker-hosts/12193/3 "2021-10-21T14:18:18Z")

</div>

Just a question more for me but applicable in this situation --  
In the static configuration file that is like the following:

```auto
providers:
  docker:
    endpoint: "unix:///var/run/docker.sock"
# endpoint: "tcp://dockerproxy:2375"
    exposedbydefault: false
    watch: true

```

Could you list multiple tcp endpoints???

---

<div class="post-metadata">

**Author:** ![selfhoster195](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/selfhoster195/32/4397_2.png) [@selfhoster195](https://community.traefik.io/u/selfhoster195)\
**Post date:** [October 21, 2021, 2:30pm UTC](https://community.traefik.io/t/using-a-single-traefik-instance-to-discover-multiple-docker-hosts/12193/4 "2021-10-21T14:30:47Z")

</div>

I was hoping for something like this:

```auto
providers:
  docker-vm1:
    type: docker
    endpoint: “”

  file1:
    type: file-provider

```

---

<div class="post-metadata">

**Author:** ![creamers](https://avatars.discourse-cdn.com/v4/letter/c/8baadc/32.png) [@creamers](https://community.traefik.io/u/creamers)\
**Post date:** [September 24, 2024, 7:38pm UTC](https://community.traefik.io/t/using-a-single-traefik-instance-to-discover-multiple-docker-hosts/12193/5 "2024-09-24T19:38:17Z")

</div>

Thanks something I would like to know also, instead of using swarm/k8s adding multiple endpoints that refer to hosts running dockers. Possible in some way to use the traefik dynamic discovery this way without swarm/k8s ?
