Docker
/Beginner
docker stats
Definition
A CLI command that displays a live, real-time stream of resource usage statistics for running containers, including CPU usage, Memory limits, and Network I/O.
Explain Like I'm New
The 'Activity Monitor' or 'Task Manager' for Docker. It shows you exactly how much RAM and CPU each container is currently eating.
Real World Example
Your server fan is spinning wildly and everything is slow. You type `docker stats`. You immediately see that the `redis` container is currently consuming 99% CPU and 16GB of RAM due to a bug.
Common Use Cases
- •Performance monitoring
- •Finding memory leaks
Interview Questions
basic
- Does `docker stats` show historical data from yesterday, or live data?
intermediate
- If a container has no resource limits set, what will the 'MEM LIMIT' column display in `docker stats`?