With the built in DNS in docker 1.10 we can connect to other containers using their container names, so
webapp_1 can ping
Using Docker Compose the containers are automatically named
<project name>_<service name>_<number> and I can ping those containers as above if I know the computed container name. However, I can also ping a container based on the service name, e.g.
webapp. How does that work if the service is scaled? Will I always get the first container? Or is it random? Is there a DNS lookup on every request or only when containers are added/changed/removed (caching the first result)?