Discovering addresses of all instances that form a service
If you browse through the official Docker documentation, you will not find any reference to addresses of individual instances that form a service.
The previous sentence might not be true at the time you're reading this. Someone might have updated the documentation. However, at the time I'm writing this chapter, there is not a trace of such information.
The fact that something is not documented does not mean that it does not exist. Indeed, there is a special DNS that will return all IPs.
To see it in action, we'll create the global service called util and attach it to the proxy
network:
docker service create --name util \
--network proxy --mode global \
alpine sleep 1000000000
docker service ps util
Before proceeding, please wait until the current state is set to running.
Next, we'll find the ID of one of the util instances and install drill that will show us the information related to DNS entries:
ID=$(docker ps -q --filter label...