Docker Community Forums

Share and learn in the Docker community.

How to connect to container running in a different stack but on same host only?

I’ve got ~20 stacks running in a swarm across ~30 hosts or so, including some ephemeral autoscaling hosts.

I’d like to start running a metrics collector service on each host, so wanted to create a new stack to deploy that service to every host using mode=global, but with no mapped ports (each collector should only be accessible from the host it’s running on).

What I’m struggling with is how to get applications running in my ~20 stacks or so to talk to the metrics container that’s running on the same host as them, but in a different stack.

Any suggestions?