Inspect containers

Print full JSON metadata

docker inspect app

Example:

docker inspect $(docker ps -q)

Extract key fields with format

docker inspect -f "{{.State.Status}}" app

Example:

docker inspect -f "{{range .Mounts}}{{.Source}} -> {{.Destination}}{{println}}{{end}}" app

Inspect images and networks

Inspect image config

docker image inspect nginx:latest

Example:

docker image inspect -f "{{.Config.Entrypoint}}" nginx:latest

Inspect network details

docker network inspect bridge

Example:

docker network inspect app_default

Pipe JSON to jq

Read container IP

docker inspect app | jq -r ".[0].NetworkSettings.IPAddress"

Example:

docker inspect app | jq ".[0].HostConfig.RestartPolicy"

List mounted volume sources

docker inspect app | jq -r ".[0].Mounts[].Source"

Example:

docker inspect app | jq ".[0].Config.Env"

Common mistakes / Errores comunes

  • Template expressions fail silently if field names are wrong; verify with raw JSON first.
  • Container IP from bridge network may not be reachable from host as expected.
  • Inspect output can expose secrets in env vars; avoid sharing raw dumps publicly.
Last updated: February 2026