Resolve Docker containers from host machine

I'm running Docker 1.12.1. I got a few containers on a user-network (bridge type), each container assigned a --network-alias. Containers resolve each other correctly, but the host is not able to resolve any container by its network alias or host name.

How can you make the host resolve names of containers on any user network?


Docker assigns IP addresses to the containers as they run, and then hosts an internal DNS system for the containers to resolve each other. Even if you've chosen a bridge network, usually the containers access each other on a private internal network to which only the other containers on that network have access.

To access containers on that private network, usually one would either:

  • forward a port to the host (e.g. with -p 8080:80 or something like that)
  • start the client software itself in a container on the same network (e.g. docker run -it ubuntu /bin/bash with the correct options to join the network).