Reading docker stats without confusing metrics
docker stats shows resource observations for running containers. A sample is not a complete history or guarantee of capacity. Use a named, approved lab container and record the time, platform, workload and effective limits before comparing measurements.
Worked example
This is an offline lesson. Scenarios are fictional and Docker commands are unexecuted. Any optional execution requires an approved disposable VM, a reviewed preloaded image with verified digest, blocked external access and appropriate resource limits. No resource exhaustion or host-policy change is required. Before any authorized optional observation, verify the effective daemon endpoint including overrides, exact object ID and observation window. Bound collection time and output bytes; do not generate resource pressure or export private telemetry. Mark unavailable measurements NOT RUN.
Illustrative snapshots (not measured)NAME CPU % MEM USAGE / LIMIT MEM % PIDSreport-a 25.0 32 MiB / 128 MiB 25.0 6report-a 45.0 48 MiB / 128 MiB 37.5 9Read-only command template: docker stats --no-stream NAMEOn Linux, Docker CLI memory usage subtracts a cache-related component from raw accounted usage; the exact calculation differs by cgroup version. PIDS can include threads. CPU percentage can exceed 100% for multi-core consumption and is not necessarily a percentage of the configured quota. Network and block I/O fields are cumulative counters, not instantaneous throughput; compare deltas over time if the container identity and counter semantics match. --no-stream returns a snapshot rather than a continuous display. Inspect configured and effective limits separately. Compare time series and application latency before resizing. The example gives 37.5% for the second snapshot. On Linux the CLI and raw API memory fields are not interchangeable without matching the cache adjustment and denominator. A stopped or replaced container and a counter reset require a fresh measurement interval.
Common mistake
A single low sample cannot prove a peak is safe.
Manual practice
Compute the memory percentage for 48 MiB of 128 MiB and explain why two samples are insufficient to establish the maximum.
Worksheet: lab-fixtures/docker-resource-management/06-stats/scenario.txt.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Reading docker stats without confusing metrics — Knowledge check
Apply resource management reasoning in a fictional scenario.
What does --no-stream request?
What is 48/128 as a percentage?
Why can PIDS exceed visible process count?