# Knowledge Check: Container Networking --- **1. A container works fine when tested with `docker exec curl localhost:80`, but `curl http://localhost:8080/` from the host fails. What's the most likely cause?** *Answer:* The container was never started with a port-publish flag (`-p 8080:80`) mapping the host port to the container's port — the app works internally, but nothing connects the host to it. --- **2. Can you add port publishing to an already-running container?** *Answer:* No — port publishing is set at container creation time; you must remove and recreate the container with the correct `-p` flag. --- **3. How can one container reach another by name instead of IP?** *Answer:* If both containers are on the same user-defined Docker network, Docker's built-in DNS resolves the target container's NAME automatically — no IP address needed. --- **4. Why does container-name resolution fail between two containers that AREN'T on the same Docker network?** *Answer:* Docker's per-network DNS only knows about containers actually attached to that specific network — being on a different (or no) network means there's no DNS entry for the target container at all. ## Instructor Notes **Facilitation:** Question 1 directly previews this module's Lab — a good moment to build anticipation for it. **Approximate timing:** 5 minutes.