Skip to content
Latchkey

docker stats: Live Container Resource Usage

Watch live CPU and memory usage per container.

docker stats streams a live view of resource usage per running container. This page covers the one-shot --no-stream mode used in CI and reading memory pressure.

What it does

docker stats shows CPU %, memory usage/limit, network I/O, and block I/O for running containers, refreshing continuously. --no-stream prints a single snapshot, which is what you want in non-interactive CI.

Common usage

Terminal
docker stats
docker stats --no-stream
docker stats --no-stream --format "{{.Name}} {{.MemUsage}} {{.CPUPerc}}"
docker stats web db

Common errors in CI

Plain docker stats never returns in CI because it streams forever and there is no TTY to interrupt it - always add --no-stream in pipelines. If MEM USAGE / LIMIT shows usage approaching the limit, the container is heading for an OOM kill (exit 137); raise --memory or fix the leak. Stopped containers do not appear in stats.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →