Show container CPU and memory usage
Read-only
What do risk levels mean?
- Read-only
- Inspects state without changing anything.
- Low risk
- Reversible with a routine follow-up command.
- Medium risk
- Changes state; undo path documented.
- Destructive
- Deletes or overwrites; confirmation required.
Takes a one-shot snapshot of CPU, memory, network, and disk I/O for all running containers to identify which one is consuming resources.
dockerstatscpumemorymonitoring
Commands
Snapshot resource usage of every running container once
docker stats --no-streamWatch usage update live until interrupted with Ctrl+C
docker statsVerification
docker stats --no-streamOne row per running container with CPU % and memory usage; no rows when nothing is running.
Undo
Not undoable
This recipe only reads resource metrics and changes nothing.
Pitfalls
- Memory limits shown are the container's cgroup limit, which on Docker Desktop is the VM's memory unless a per-container limit was set.
- High CPU % can exceed 100 on multi-core hosts; it is a sum across cores.