beginnerDocker Networking: Bridge, Host, Overlay, DNS & Port Mapping

Service A can't reach Service B by hostname despite both running

Two containers are started with plain `docker run` (no --network flag) and one tries to call the other by container name; it fails with a DNS resolution error. Diagnose. Expected reasoning: both containers landed on the default bridge network, which has no embedded DNS for container-name resolution. Fix: create a user-defined bridge network and run both containers attached to it (`--network app-net`), after which name-based resolution works automatically.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to A container's published port works locally but isn't reachable from another machine on the network← Back to all Docker questions