Interview Prep/Networking/Containers, Kubernetes, IPv6 and packet captures

Two containers on the default bridge network can't reach each other by container name.

BeginnerTroubleshootingContainers, Kubernetes, IPv6 and packet captures
Answer

Likely causes → The default bridge network has no embedded DNS for container names. Name resolution works only on user-defined networks (and in Compose, which creates one).

Diagnose →

docker network inspect bridge --format '{{range .Containers}}{{.Name}} {{.IPv4Address}}{{"\n"}}{{end}}'
docker exec app getent hosts db

Fix →

docker network create appnet
docker run -d --name db --network appnet postgres:17
docker run -d --name app --network appnet myapp
docker exec app getent hosts db

Prevent → Always use user-defined networks or Compose; never rely on the deprecated --link.

All Networking questions Roadmap: Networking for DevOps

More on Containers, Kubernetes, IPv6 and packet captures