inspection

docker inspect

Returns low-level JSON metadata about Docker objects — containers, images, networks, volumes, and more. Supports Go template formatting for extracting specific fields.

docker inspect [OPTIONS] NAME|ID [NAME|ID...]

Common flags

Flag Purpose
-f, --format Format output with a Go template
--type Restrict to a specific object type (container, image, network, etc.)
-s, --size Include size information for containers

Examples

docker inspect web

Full JSON metadata for the container

docker inspect -f '{{.NetworkSettings.IPAddress}}' web

Extract just the container IP

docker inspect --type image nginx:alpine

Force lookup as an image when names collide

docker inspect -f '{{range .Mounts}}{{.Source}}->{{.Destination}}{{println}}{{end}}' db

List mount sources and destinations

Gotcha

Container and image can share the same name — use --type to disambiguate. Field paths are case-sensitive and change between object types; check the JSON structure first before writing a template.

Related commands

← All Docker commands · Docker vs Kubernetes · Docker vs VMs