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 apiDNS question (decoded message)
QNAME apiQTYPE Asent to 127.0.0.11:53