Which DNS settings do you adjust when containers cannot resolve internal company hosts?
IntermediateScenarioNetworking and Compose
Answer
Situation read → Containers on user-defined networks use Docker's embedded DNS at 127.0.0.11, forwarding to the host's resolvers; with systemd-resolved the host stub 127.0.0.53 is unusable.
What I'd do →
{"dns": ["10.0.0.2"], "dns-search": ["corp.example.com"]}
in daemon.json, or per run --dns 10.0.0.2 --dns-search corp.example.com. Test with docker run --rm busybox nslookup intranet.corp.example.com.
Why → Docker substitutes the real upstream resolvers from /run/systemd/resolve/resolv.conf.
Interview tip → Check VPN split-DNS interactions.
More on Networking and Compose
Containers on the default bridge cannot resolve each other by name. Why, and what do you do?BeginnerHow do you expose a container only to the local host, not the internet?BeginnerDesign a Compose file for web + api + postgres + redis with correct startup ordering.IntermediateFrontend must reach the API but not the database. Segment the network.IntermediateA container needs to call a service running on the Docker host.BeginnerWhen would you use `--network host`?Intermediate