Docker Community Forums

Share and learn in the Docker community.

How swarm services inter-communication works

Hi,

I’ve been looking the documentation and I can not really make a clear picture on how inter service communication works inside a swarm.

A bit of background: I have multiple services, and some of them are the authentication service. Each authentication service generates his own key-pair (public-private key) for “json web token” validation. Other services must be able to query the public key (through grpc) to this specific authentication service. The hostname of the authentication service that issue a specific “json web token” is embedded in the payload, so others services inside the swarm can contact a posterior for the specific public key.

The problem: As I understand (not very well), by default docker swarm services have a virtual ip address routed by the ingress network. Is that meaning that I can not just query to the hostname (or ip address) for the public key as this will be resolved to any of the authentication services (not guaranteed to be the same that issue the “json web token”)? What is the way to go for intercommunication between services inside the same swarm that needs to distinguish between different instances of the same services?

Thanks in advance.