Explain how you would debug a container with no shell and no network tools.
AdvancedScenarioNetworking and Compose
Answer
Situation read → Distroless image, need to run tcpdump or curl.
What I'd do →
docker run --rm -it --network container:myapp --pid container:myapp \
nicolaka/netshoot
# or
docker debug myapp
# kubernetes
kubectl debug -it pod/myapp --image=nicolaka/netshoot --target=myapp
Why → Joining the target's network (and PID) namespace gives full tooling without changing the image.
Interview tip → Never install tools into prod images "just for debugging".
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