Skip to content

Container DNS: how web finds api by name

Select an icon to see what it is.

Step 5 of 6

Other names go upstream

For a name that is not a container, such as example.com, the embedded server forwards the query to the DNS servers in the host's /etc/resolv.conf. It relays the answer back to the container. The container never talks to those servers directly.

$ docker exec web getent hosts example.com

Forwarded question (decoded message)

QNAME example.com
QTYPE A
sent to the host's configured resolvers