Attach local network to service in swarm


I’m currently deploying services into a swarm with an overlay network, which works fine. I would also like to then connect one service in a swam to another service in the swarm, but only local nodes to local nodes. So it’d look like this:

X = service 1
Y = service 2
ON1 = overlay network 1, attached to service 1      
ON2 = overlay network 2, attached to service 2
LN1 = local network 1, which links instances of service 1 and 2 on the same host

 |            |
LN1          LN1
 |            |

Now, I can set this up by attaching the services to the default bridge network, which gives me the exact effect I’m after, however the default bridge doesn’t allow for service discovery via dns lookup.

Whenever I attempt to attach another local or bridge network to the running services, it says that it’s not a valid network. Is there either:

  • Some way to add a locally scoped network to a service?
  • Some way to add service discovery to the bridge network?

Many thanks!