Docker swarm when using overlay network, how to do service discovery

Such as service A call service B, after deployment, A and B in an overlay network, that A how to know B's IP

Heads up! This alert needs your attention, but it's not super important.