# docker inspect Command Reference

> Reference for docker inspect in CI: print low-level JSON for containers, images, volumes, and networks, and extract fields with --format for scripting.

Source: https://latchkey.dev/learn/command-reference/docker-inspect-command-reference  
Updated: 2026-06-26

Return low-level information on Docker objects as JSON.

docker inspect outputs the full JSON metadata for one or more containers, images, volumes, or networks. In CI it is used with --format to pull out a single field such as health status, exit code, or assigned IP for use in scripts.

## Common flags

- `--format` - Go template to extract a field, e.g. "{{.State.Health.Status}}"
- `--type` - restrict object type, e.g. container or image
- `-s, --size` - include container size (with --type container)

## Example

```shell
docker inspect --format '{{.State.Health.Status}}' app-db
docker inspect --format '{{.State.ExitCode}}' app-tests
docker inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' app-web
```

## In CI

Poll docker inspect --format {{.State.Health.Status}} until it reports healthy before running tests against a dependency. Read {{.State.ExitCode}} to fail a job on a non-zero container exit when the container itself does not propagate status.

## FAQ

### docker inspect Command Reference?

docker inspect outputs the full JSON metadata for one or more containers, images, volumes, or networks. In CI it is used with --format to pull out a single field such as health status, exit code, or assigned IP for use in scripts.

### In CI?

Poll docker inspect --format {{.State.Health.Status}} until it reports healthy before running tests against a dependency. Read {{.State.ExitCode}} to fail a job on a non-zero container exit when the container itself does not propagate status.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
