podman inspect: Read Container and Image Metadata
podman inspect dumps the full configuration and state of a container, image, volume, or network as JSON.
When a script needs a container IP, an image digest, or an exit code, podman inspect with --format pulls the exact field without parsing human output.
What it does
podman inspect returns a detailed JSON document describing the given object. With --format you apply a Go template to extract one value, which is the scripting-friendly way to read state, config, or metadata.
Common usage
podman inspect db
podman inspect -f '{{.State.Running}}' db
podman inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' db
podman inspect -t image -f '{{.Digest}}' ghcr.io/owner/app:1.2.3Options
| Flag | What it does |
|---|---|
| -f, --format <tmpl> | Go template to extract a field |
| -t, --type <type> | Object type: container, image, volume, network, pod |
| -s, --size | Include container size info |
| -l, --latest | Inspect the most recently created container |
In CI
Read exit status with podman inspect -f "{{.State.ExitCode}}" to gate a step, or grab the image digest with -t image -f "{{.Digest}}" to record exactly what was deployed. Quote Go templates in single quotes so the shell does not expand the braces.
Common errors in CI
"Error: no such object: <name>" means the name does not match any container, image, volume, or network, or the -t type is wrong; set -t explicitly when a name could be ambiguous. "Error: template: ... can't evaluate field X" means the field path does not exist for that object; inspect without --format first to see the real structure.