Interview Prep/Docker/Networking and Compose

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".

All Docker questions Roadmap: Docker & containers

More on Networking and Compose