I have a Docker swarm of two machines, and started a service with two replicas:
$ docker service create --replicas 2 --name myservice --network ingress alpine:latest sleep 1d
Now I've got two containers myservice.1.<some_nonce>
and myservice.2.<other_nonce>
on different machines that can communicate through the overlay network, as expected.
The problem is how to make the instances discoverable for each other. For example, for myservice.1
there should be a way to find myservice.2
without knowing the nonce.
Internal DNS can only resolve the name myservice
but not a particular task.