What is Docker inspect?
docker inspect is a command that returns detailed, low-level information on Docker objects. Those objects can be docker images, containers, networks, volumes, plugins, etc.
Syntax
docker inspect [OPTIONS] NAME|ID [NAME|ID...]
- OPTIONS
--format: Format the output using the given Go template--size: Display total file sizes if the type is container--type: Return JSON for specified type
By default,
docker inspectreturns information in JSON format.
Examples
- Get an instance’s IP address:
docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $INSTANCE_NAME
- Get multiple instances’ image name:
docker inspect --format='{{.Config.Image}}' $INSTANCE1_ID $INSTANCE2_ID
- List all port bindings:
docker inspect --format='{{range $p, $conf := .NetworkSettings.Ports}} {{$p}} -> {{(index $conf 0).HostPort}} {{end}}' $INSTANCE_NAME
Free Resources
Copyright ©2026 Educative, Inc. All rights reserved