Container DNS Resolution
Cheat sheet · https://pcornel.dk/topic.php?topic=6132
Answer
Container DNS: Docker's embedded DNS (127.0.0.11) resolves container names on user-defined networks; Kubernetes CoreDNS resolves Service and pod names with search domains from the pod's resolv.conf.
Remember
In Kubernetes, ndots:5 makes short external names try cluster suffixes first — use FQDNs with a trailing dot for heavy external lookups. Check CoreDNS pods and logs.
First checks
docker ps -a— containers and exit codesdocker logs <c>— container outputdocker inspect <c>— config, mounts, network, state
Commands
docker exec c cat /etc/resolv.confnslookup apikubectl exec pod -- nslookup kubernetes.defaultkubectl -n kube-system get pods -l k8s-app=kube-dns
Verify in this order
container resolver → embedded DNS/CoreDNS → cluster records or upstream
Where it usually breaks
A host that uses 127.0.0.53 (systemd-resolved) passes an unusable nameserver to containers on the default bridge.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6132