How do you inspect which containers are attached to a network and their IPs?
BeginnerScenarioNetworking and Compose
Answer
Situation read → Need a quick topology view.
What I'd do →
docker network ls
docker network inspect appnet \
--format '{{range .Containers}}{{.Name}} {{.IPv4Address}}{{"\n"}}{{end}}'
Why → Shows membership, subnet and gateway.
Interview tip → docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' c for one container.
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