Interview Prep/Docker/Networking and Compose

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.

All Docker questions Roadmap: Docker & containers

More on Networking and Compose