Docker runs its own container DNS that means you can easily link containers together just by specifying their names, instead of having to work out their dynamically assigned IP's somehow. Unfortunately NGINX doesn't read the /etc/hosts file that docker edits, and so can't resolve hostnames of other containers.


An earlier hacky solution was to bundle dnsmasq in with nginx and have it use as a resolver, violating the one process per container best practice.

As of Docker 1.10 you can use the new embedded DNS feature by setting as the resolver in nginx.conf, just be aware that there are issues with IPv6.