docker inspect: Low-Level Container & Image Detail
Get the full JSON metadata for any Docker object, scriptable with --format.
docker inspect returns low-level JSON for containers, images, networks, and volumes. This page covers extracting fields with Go templates, the workhorse for CI scripts.
What it does
docker inspect dumps the full configuration and state of an object as JSON: container exit code, health, mounts, network IPs, image config, and more. --format pulls a single field for scripts.
Common usage
docker inspect web
docker inspect --format '{{.State.ExitCode}}' web
docker inspect --format '{{.State.Health.Status}}' web
docker inspect --format '{{json .NetworkSettings.Ports}}' webCommon errors in CI
"Error: No such object: NAME" means the container/image does not exist - check the name. A common scripting bug is "<no value>" output when a field is null or the path is wrong (e.g. .State.Health on a container with no HEALTHCHECK); guard for it. Use docker inspect --format '{{.State.ExitCode}}' to read a CI container exit code reliably.