Hosting Operations
Read-onlySnapshot Container CPU and Memory
You need a quick CPU and memory snapshot for running containers.
Command
docker stats --no-stream --format 'table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}\t{{.BlockIO}}'
Before you run this
System impact: Read-only. Low when scoped to the shown target.
When not to use it: Do not treat one snapshot as a trend; repeat it or use monitoring for longer windows.
Expected output
A table showing container CPU percentage, memory usage, network I/O, and block I/O.
System impact
Read-only. Nothing changes. Docker reads current resource counters.
Recovery / rollback: no state is changed.
When to use it
Use when a host is slow, memory pressure is suspected, or one container may be noisy.
When not to use it
Do not treat one snapshot as a trend; repeat it or use monitoring for longer windows.
Watch this command run
Command transcript
This sanitized transcript shows the commands and output shape without exposing host details.
$ docker stats --no-stream --format 'table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}\t{{.BlockIO}}'
NAME CPU % MEM USAGE / LIMIT NET I/O BLOCK I/O
web 0.12% 42.1MiB / 512MiB 1.2MB / 880kB 4.1MB / 0B
api 8.40% 180.4MiB / 512MiB 3.8MB / 1.1MB 18MB / 2MB
$ docker stats --no-stream web
CONTAINER ID NAME CPU % MEM USAGE / LIMIT
abc123 web 0.12% 42.1MiB / 512MiB
View commands shown
These are the commands shown in the sanitized transcript.
Commands shown
docker stats --no-stream --format 'table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}\t{{.BlockIO}}'docker stats --no-stream web
next steps
Related commands
Check Container Health Status
Docker may say a container is running while its health check says otherwise.
docker inspect --format '{{.Name}} health={{if .State.Health}}{{.State.Health.Status}}{{else}}none{{end}} status={{.State.Status}}' web
See Container Network Attachments
A container can be healthy and still attached to the wrong network.
docker inspect --format '{{.Name}} {{range $name, $net := .NetworkSettings.Networks}}{{$name}} {{$net.IPAddress}} {{end}}' api
Show Containers in a Clean Triage Table
Turn noisy docker ps output into the few fields operators scan first.
docker ps -a --format 'table {{.Names}}\t{{.Status}}\t{{.Image}}\t{{.Ports}}'
Summarize Docker Disk Usage
See how Docker storage is split across images, containers, volumes, and cache.
docker system df -v
Find a Discarded Commit in Reflog
A reset does not mean the commit vanished.
cd /lab/git-recovery-rollback && git reflog --date=iso --format='%h %gd %gs' -6
Study mapping
Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.
Useful for
- LPIC-1 style command-line practice
- LFCS style performance tasks
- Linux+ style troubleshooting review
Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.