Docker version 1.12.4 - swarm mode
Created a service “web” with 3 replicas.
docker service tasks web
ID NAME SERVICE IMAGE LAST STATE DESIRED STATE NODE
9tsk9hw2uac4tsharxkuzf981 web.1 web nginx:alpine Running about a minute ago Running moby
1opisbjf2ypok3cakoq2gmm4e web.2 web nginx:alpine Running 6 seconds ago Running moby
3zqyv3sx6juzmlvxrcpl7adxo web.3 web nginx:alpine Running 6 seconds ago Running moby
From inside one of the container (e.g. the second one) I need to code something (using a bash initialization script) which is able to retrieve the symbolic/pretty name (e.g. “web.2”).
In other words: is there something (some kind of DNS alias or other) that permits to each container to discover by itself (without using the Docker demon) which is the “pretty” name uniquely assigned to it by swarm ?
Thanks