See every layer of an image, its command, and its size.
docker history shows how an image was built layer by layer. This page covers reading layer sizes to slim images and the --no-trunc flag.
What it does
docker history lists each layer of an image: the Dockerfile instruction that created it, its size, and age. It is the tool for finding which step bloated an image.
Common usage
Terminal
docker history myapp:latest
docker history --no-trunc myapp:latest
docker history --format "{{.Size}} {{.CreatedBy}}" myapp:latest
Common errors in CI
history truncates the command column by default - add --no-trunc to see the full RUN line behind a fat layer. Layers from a registry pull may show "<missing>" for intermediate layers because only the final config is present; that is expected, not an error. Use it in CI image-size audits to spot a RUN that should have cleaned up after itself.