docker image inspect displays detailed metadata and configuration for a Docker image. With formatted output, it can expose image labels that record build information and provenance. section 11.3
Use the command to:
- Check labels such as the application version, build number, and build tag. section 11.3
- Trace an image from its CI job and source-code version through the image used in an environment. section 11.3
- Select only the relevant metadata with a Go-template format expression instead of reading the full inspection output. section 11.3
Inspect image labels
After building an image with a build argument, run `docker image inspect -f '{{.Config.Labels}}' numbers-api`. The result lets you verify the labels applied during the build. section 11.3
cd ch11/exercises
# build both images:
docker compose `
-f docker-compose.yml `
-f docker-compose-build.yml `
build
# check the labels for the web image:
docker image inspect -f '{{.Config.Labels}}' `
diamol/ch11-numbers-api:2e-v3-build-local
Shows a Compose build followed by a formatted docker image inspect command that checks the API image labels. section 11.3
