Hosting Operations
Read-onlySee Container Network Attachments
Services cannot reach each other and you need to confirm container network membership.
Command
docker inspect --format '{{.Name}} {{range $name, $net := .NetworkSettings.Networks}}{{$name}} {{$net.IPAddress}} {{end}}' api
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 packet-level diagnosis; follow up with DNS and connectivity checks when needed.
Expected output
/api app_net 172.18.0.5
System impact
Read-only. Nothing changes. Docker reads container networking metadata.
Recovery / rollback: no state is changed.
When to use it
Use when containers cannot connect by service name, expected networks are missing, or IP assumptions look wrong.
When not to use it
Do not use it as a packet-level diagnosis; follow up with DNS and connectivity checks when needed.
Watch this command run
Command transcript
This sanitized transcript shows the commands and output shape without exposing host details.
$ docker inspect --format '{{.Name}} {{range $name, $net := .NetworkSettings.Networks}}{{$name}} {{$net.IPAddress}} {{end}}' api
/api app_net 192.0.2.20
$ docker network ls
NETWORK ID NAME DRIVER
n1 bridge bridge
n2 app_net bridge
View commands shown
These are the commands shown in the sanitized transcript.
Commands shown
docker inspect --format '{{.Name}} {{range $name, $net := .NetworkSettings.Networks}}{{$name}} {{$net.IPAddress}} {{end}}' apidocker network ls
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
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}}'
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>/'
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}}'
List SQLite User Tables Only
System metadata tables can distract from the app tables you care about.
sqlite3 app.db "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;"
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.