Hosting Operations
Read-onlyCheck Container Health Status
You need to see health-check state without opening a full inspect dump.
Command
docker inspect --format '{{.Name}} health={{if .State.Health}}{{.State.Health.Status}}{{else}}none{{end}} status={{.State.Status}}' web
Before you run this
System impact: Read-only. Low when scoped to the shown target.
When not to use it: Do not use it as a full app check if the image has no HEALTHCHECK.
Expected output
/web health=healthy status=running
System impact
Read-only. Nothing changes. Docker reads container state metadata.
Recovery / rollback: no state is changed.
When to use it
Use when a container is running but the service still seems unavailable.
When not to use it
Do not use it as a full app check if the image has no HEALTHCHECK.
Watch this command run
Command transcript
This sanitized transcript shows the commands and output shape without exposing host details.
$ docker inspect --format '{{.Name}} health={{if .State.Health}}{{.State.Health.Status}}{{else}}none{{end}} status={{.State.Status}}' web
/web health=healthy status=running
$ docker inspect --format '{{range .State.Health.Log}}{{.End}} {{.ExitCode}} {{.Output}}{{end}}' web
/web health=healthy status=running
View commands shown
These are the commands shown in the sanitized transcript.
Commands shown
docker inspect --format '{{.Name}} health={{if .State.Health}}{{.State.Health.Status}}{{else}}none{{end}} status={{.State.Status}}' webdocker inspect --format '{{range .State.Health.Log}}{{.End}} {{.ExitCode}} {{.Output}}{{end}}' web
next steps
Related commands
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
Snapshot Container CPU and Memory
Get Docker resource usage once, without leaving a live dashboard running.
docker stats --no-stream --format 'table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}\t{{.BlockIO}}'
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}}'
Inspect Container Environment Names
Check what environment variables exist without printing their secret values.
docker inspect --format '{{range .Config.Env}}{{println .}}{{end}}' api | sed 's/=.*$/=<redacted>/'
Summarize Docker Disk Usage
See how Docker storage is split across images, containers, volumes, and cache.
docker system df -v
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.