- List local images
- Examine image history
- Inspect detailed metadata
- Filter output with JSONPath
Table of Contents
- Prerequisites
- Listing Local Images
- Viewing Image History
- Inspecting Image Metadata
- Filtering with JSONPath
- References
Prerequisites
Ensure you have Docker installed and running. Check your version with
For full installation steps, visit the Docker Docs.
docker version.For full installation steps, visit the Docker Docs.
Listing Local Images
To see all images stored on your host machine, use:| Command | Description |
|---|---|
docker image list | List all images locally |
Viewing Image History
Examining an image’s history reveals each layer and the command that created it. This is especially valuable if the Dockerfile isn’t available.| Command | Description |
|---|---|
docker image history <IMAGE> | Show layer-by-layer build commands |
Inspecting Image Metadata
Theinspect command returns comprehensive image metadata in JSON format, including environment variables, exposed ports, volumes, and more.
Inspecting very large images may output extensive JSON. Use filtering (see next section) or redirect output to a file:
| Command | Description |
|---|---|
docker image inspect <IMAGE> | Display full image metadata (JSON) |
Filtering with JSONPath
Docker’sinspect supports the -f flag with JSONPath templates to extract specific fields.
Common Filters
| Filter Template | Description |
|---|---|
-f '{{.Os}}' | Display the OS |
-f '{{.Architecture}}' | Show the architecture |
-f '{{.Architecture}} {{.Os}}' | Combine architecture and OS |