Skip to content

Container DNS: how web finds api by name

Select an icon to see what it is.

Step 2 of 6

web asks for api

When the program in web resolves the name api, the libc resolver sends a DNS query to 127.0.0.11, port 53. Rules inside the container's namespace redirect it to a socket that dockerd listens on. So dockerd answers, not a real DNS server.

$ docker exec web getent hosts api

DNS question (decoded message)

QNAME api
QTYPE A
sent to 127.0.0.11:53