Inspecting & Debugging Containers
Intermediate
Overview
When something misbehaves, docker logs shows a container's output; add -f to follow it live. docker exec lets you run a command (often a shell) inside a running container.
docker inspect dumps detailed JSON about a container or image — its mounts, networks, environment, and more. docker stats shows live CPU and memory usage.
These four commands cover the vast majority of day-to-day container troubleshooting.
Cheatsheet
docker logs -f <name>Follow a container's logsdocker exec -it <name> shOpen a shell inside itdocker inspect <name>Full JSON detailsdocker statsLive resource usagedocker top <name>Processes running insideTry it
A safe, simulated terminal. Run the suggested commands to see typical output.
simulated terminal
Type a command and press Enter, or click a suggestion below to run it.
Quick quiz
1. Which command opens an interactive shell inside a running container?
2. What does adding -f to docker logs do?