# Traefik 3.x sharing with multiple stacks - docker swarm

**URL:** <https://community.traefik.io/t/traefik-3-x-sharing-with-multiple-stacks-docker-swarm/23852>\
**Category:** Traefik v3 (latest)\
**Tags:** docker-swarm\
**Created:** [August 1, 2024, 8:05pm UTC](https://community.traefik.io/t/traefik-3-x-sharing-with-multiple-stacks-docker-swarm/23852 "2024-08-01T20:05:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![douglas](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/douglas/32/9131_2.png) [@douglas](https://community.traefik.io/u/douglas)\
**Post date:** [August 1, 2024, 8:05pm UTC](https://community.traefik.io/t/traefik-3-x-sharing-with-multiple-stacks-docker-swarm/23852/1 "2024-08-01T20:05:02Z")

</div>

I have a traefik configuration using swarm with the following stack configuration:

```auto
version: "3.3"

services:

  traefik:
    image: "traefik:v3.1"
    command:
      - "--log.level=DEBUG"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entryPoints.web.address=:80"
      - "--entryPoints.websecure.address=:443"
      - "--certificatesresolvers.myresolver.acme.dnschallenge=true"
      - "--certificatesresolvers.myresolver.acme.dnschallenge.provider=cloudflare"
      #- "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
      - "--certificatesresolvers.myresolver.acme.email=tech@email.com"
      - "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    environment:
      - "CF_API_EMAIL=email"
      - "CF_API_KEY=key"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - type: bind
        source: '/root/letsencrypt'
        target: '/letsencrypt'
        read_only: false      
    networks:
      - default
      - public_web   
 

networks:
  public_web:
    external: true

```

Now I am unable to configure a second stack, making it access traefik.

In short, I have a traefik stack and I would like the whoami stack to be able to access traefik.

Here's the whoami stack:

```auto
version: "3.3"

services:

  whoamiService:
    image: "traefik/whoami"
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=public_web"
      - "traefik.http.routers.whoamiService.rule=Host(`teste.example.com.br`)"
      # - "traefik.http.services.whoamiService.loadbalancer.server.port=80"
      - "traefik.http.routers.whoamiService.service=whoamiService"
      # - "traefik.http.routers.whoami.entrypoints=websecure"
      # - "traefik.http.routers.whoami.tls.certresolver=myresolver"
    networks:
      - public_web
networks:
  public_web:
    external: true

```

Is there a possibility of making other stacks able to talk to the traefik stack?

---

<div class="post-metadata">

**Author:** ![isay](https://avatars.discourse-cdn.com/v4/letter/i/c67d28/32.png) [@isay](https://community.traefik.io/u/isay)\
**Post date:** [September 19, 2024, 2:53pm UTC](https://community.traefik.io/t/traefik-3-x-sharing-with-multiple-stacks-docker-swarm/23852/2 "2024-09-19T14:53:25Z")

</div>

hello, did you find a solution i have the same problem

---

<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:** [September 19, 2024, 4:49pm UTC](https://community.traefik.io/t/traefik-3-x-sharing-with-multiple-stacks-docker-swarm/23852/3 "2024-09-19T16:49:07Z")

</div>

Well, what’s your issue?

If you deploy a stack, you probably use Docker Swarm. In Traefik v3, there is a new dedicated `providers.swarm` ([doc](https://doc.traefik.io/traefik/providers/swarm/)).

---

<div class="post-metadata">

**Author:** ![isay](https://avatars.discourse-cdn.com/v4/letter/i/c67d28/32.png) [@isay](https://community.traefik.io/u/isay)\
**Post date:** [September 23, 2024, 3:58pm UTC](https://community.traefik.io/t/traefik-3-x-sharing-with-multiple-stacks-docker-swarm/23852/4 "2024-09-23T15:58:50Z")

</div>

i work on different Vm's  
my first VM contains traefik under this config:

```auto
version: '3'
services:
  reverse-proxy:
    image: traefik:v3.0
    command: --log.level=DEBUG --api.insecure=true --providers.swarm=true --providers.swarm.endpoint=unix:///var/run/docker.sock --providers.swarm.network=overlay_stg_net
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    networks:
      - overlay_stg_net
    deploy:
      placement:
        constraints:
          - node.role == manager

networks:
  overlay_stg_net:
    external: true
    driver: overlay
    attachable: true

```

then i have 2 VM containing the docker compose of my application that should be detected by traefic to apply load balancing between them

```auto
version: '3'

services:
  nginx:
    image: nginx:1.22-alpine
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf
      - ./:/code
    deploy:
      labels:
        - "traefik.enable=true"
        - "traefik.docker.network=overlay_stg_net"
        - "traefik.http.routers.nginx.rule=Host(`stg-eco-drive.docker.localhost`)"
        - "traefik.http.services.nginx.loadbalancer.server.port=8080"
    networks:
      - overlay_stg_net
  php:
    build: .
    volumes:
      - ./:/code
    networks:
      - overlay_stg_net

networks:
  overlay_stg_net:
    external: true
    driver: overlay

```

traefic doesnt detect my app  
if docker swarm isnt obligatory in this case with a simpler config options then it would be preferable to use it simply with docker  
thanks in advance
