Back to commands

Hosting Operations

Read-only

Check 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.

next steps

Related commands

Hosting Operations Read-only

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
Hosting Operations Read-only

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}}'
Hosting Operations Can be slow

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}}'
Cybersecurity Triage Read-only

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>/'
Hosting Operations Read-only

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.

  • LFCS style performance-task practice

Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.