Traefik 3.x sharing with multiple stacks - docker swarm

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

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:

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?

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

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).

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

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

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