# docker history Command Reference

> Reference for docker history in CI: show the layers of an image with sizes and creating instructions to debug image bloat and cache busting in pipelines.

Source: https://latchkey.dev/learn/command-reference/docker-history-command-reference  
Updated: 2026-06-26

Show the layer history of an image.

docker history lists the layers that make up an image, each with the instruction that created it and the size it added. In CI it helps diagnose why an image is large or why a layer keeps cache-missing on every build.

## Common flags

- `--no-trunc` - show full output without truncating the command column
- `-H, --human` - print sizes in human-readable units (default true)
- `-q, --quiet` - show only layer IDs
- `--format` - Go template output for scripting

## Example

```shell
docker history --no-trunc myorg/app:${{ github.sha }}
docker history --format "{{.Size}}\t{{.CreatedBy}}" myorg/app:latest
```

## In CI

When an image is unexpectedly large, docker history shows which instruction added the bulk so you can reorder, combine, or move that work to an earlier multi-stage stage. It also reveals a layer whose command changes every build and therefore never caches.

## FAQ

### docker history Command Reference?

docker history lists the layers that make up an image, each with the instruction that created it and the size it added. In CI it helps diagnose why an image is large or why a layer keeps cache-missing on every build.

### In CI?

When an image is unexpectedly large, docker history shows which instruction added the bulk so you can reorder, combine, or move that work to an earlier multi-stage stage. It also reveals a layer whose command changes every build and therefore never caches.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
