How do I resolve hostnames to Docker containers from the host?
I understand Docker runs a magical dns on 127.0.0.11, so I figured I’d try
nslookup mycontainername 127.0.0.11
mycontainername is, of course, the name of the container I’m trying to access. However, that timed out.
;; connection timed out; no servers could be reached
What am I doing wrong? I’m on Docker 1.10.3. If it helps, I’m pulling up a bunch of containers using
EDIT This is a duplicate of Docker 1.10 access a container by it's hostname from a host machine
One Solution collect form web for “How do I resolve hostnames to Docker containers from the host?”
In the documentation it implies that this only works if you’ve explicitly created a network and attached the containers to them. Try something like:
docker network create -d bridge --subnet 172.25.0.0/16 isolated_nw docker network connect isolated_nw mycontainername
And see if you can use 127.0.0.11 (worked for me on version 1.10.3)
For more information see this ticket.