Docker Community Forums

Share and learn in the Docker community.

Communication of services running in different stacks (Swarm mode + DAB)


(Cgadam) #1

Hi people,

I’ve been using docker swarm mode + DAB and I would like to know which is the best way of communicating services living in different stacks?. Basically, when you deploy a stack a new network is created each time which seems to be specifically for that stack. Inside that stack you can have services communicating to each other doing things like http://serviceA:3000 or http://serviceB:3000 (internal load balancer + DNS does the rest for you) but what if I need to communicate to a service leaving in another stack?? The other stack itself is even running in a different network!
I tried defining an external network in my 2 .yml (two stacks I was working on) so that both stacks would connect to the same network but I’m getting this warning:

WARNING: Unsupported top level key ‘networks’ - ignoring

And then when I deploy my DAB a new network with a prefix (name of the stack) is always created.
I would really like to be able to communicate with services living in other stacks! Also, how about a command for listing existing stacks! :slight_smile: That would be useful too.

Hope someone knows the answer, or, is willing to take this into account for the experimental features!


(Seafoodbuffet) #2

It’s not a perfect answer but what I’m doing in practice to create networks that are shared between stacks is to pre-create the networks and declare any inter-stack networks as external. It’s not perfect but works in practice.


(Craigivy) #3

After creating an external host and binding services to it in one stack how to you access this service from the other stack. The other stack uses “shared” network but unclear what the service name should be.