Docker images are notoriously opaque when it comes to understanding what goes into each layer and how much space is wasted. dive tackles this by reconstructing the merged filesystem view layer by layer, exposing file-level diffs and enabling developers to identify bloat and inefficiencies right from the terminal.
How dive inspects Docker image layers
dive is a terminal-based tool written in Go that lets you explore Docker and OCI image layers interactively. It presents a TUI (terminal user interface) where you can drill down into each layer of an image, inspect the files added, modified, or removed, and navigate a file tree per layer.
Under the hood, dive walks the OCI manifest, which describes the ordered layers of a container image. It reconstructs the merged filesystem by applying these layers sequentially and computing the diffs at the file level between layers. This approach means you see exactly what files are introduced or changed in each layer, helping you understand where space is being used or wasted.
The tool supports Docker, Podman, and docker-archive image sources, making it flexible across container runtimes. It also introduces an experimental “image efficiency” metric that quantifies wasted space caused by duplicated or orphaned files scattered across layers.
The technical strengths and tradeoffs of dive
dive’s standout feature is its clever use of the container image specification to reconstruct a merged view from layered file systems. This requires parsing image manifests, extracting layer tarballs, and performing file-level diff computations.
From a code quality perspective, dive is written entirely in Go, which suits CLI tools and system utilities well due to Go’s strong concurrency model and static typing. The codebase maintains a clear separation between the TUI components and the image analysis logic, which is critical for maintainability and potential CI integration.
One tradeoff is that dive’s diffing and file tree reconstruction can be resource-intensive for very large images with many layers or files. The experimental efficiency metric is a useful heuristic but may not capture all edge cases perfectly. Also, the TUI interface, while interactive, may have a learning curve for those unfamiliar with terminal-based navigation.
The project supports CI integration through a CI=true environment variable that enables pass/fail gating based on configurable efficiency thresholds. This is a practical feature for automated image size monitoring in build pipelines.
Installation commands to get started with dive
Ubuntu/Debian
DIVE_VERSION=$(curl -sL "https://api.github.com/repos/wagoodman/dive/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
curl -fOL "https://github.com/wagoodman/dive/releases/download/v${DIVE_VERSION}/dive_${DIVE_VERSION}_linux_amd64.deb"
sudo apt install ./dive_${DIVE_VERSION}_linux_amd64.deb
RHEL/Centos
DIVE_VERSION=$(curl -sL "https://api.github.com/repos/wagoodman/dive/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
curl -fOL "https://github.com/wagoodman/dive/releases/download/v${DIVE_VERSION}/dive_${DIVE_VERSION}_linux_amd64.rpm"
rpm -i dive_${DIVE_VERSION}_linux_amd64.rpm
Arch Linux
pacman -S dive
Mac
brew install dive
Windows
choco install dive
Go tools
go install github.com/wagoodman/dive@latest
This covers the main supported platforms and installation methods. Using the Go install method requires Go 1.10 or higher but note it won’t show a proper version with dive -v.
Who dive is for and the verdict
dive is a practical tool for developers, DevOps engineers, and CI pipeline maintainers who want to understand and optimize Docker/OCI image sizes. It solves a real problem: the opacity of container image layers and the challenge of trimming unnecessary bloat.
The interactive TUI and file-level insights make it highly useful in development and pre-production workflows. The CI integration feature also brings value for automated size checks.
Limitations include its resource usage on large images and the experimental nature of its efficiency metric, which means it shouldn’t be the sole basis for image optimization decisions. The terminal UI might not suit everyone, especially those preferring graphical tools.
Overall, dive is a solid, well-architected tool that complements Docker image workflows by providing transparency and actionable insights into image composition. Worth exploring if you regularly build or audit container images and want a deeper understanding of your image layers.
Related Articles
- Converseen: a cross-platform batch image converter built on ImageMagick — Converseen wraps ImageMagick C++ bindings into a GUI app for batch image conversion and resizing across 100+ formats on
- Xplorer: A modern AI-native file manager built with Tauri, Rust, and React — Xplorer is a Tauri-based desktop file manager integrating AI for semantic search, context-aware chat, and agentic file o
- FSearch: a lightweight C-based instant file search tool for Linux desktops — FSearch delivers instant file search on Linux using a pre-built indexed database. Written in C with GTK3, it balances pe
- docker_practice: a comprehensive open-source Docker learning book with containerized local reading — docker_practice offers a systematic Docker learning book with basics, advanced topics, and practical tooling. It uses Do
- FinalRecon: a unified Python CLI for comprehensive web reconnaissance and OSINT automation — FinalRecon consolidates fragmented OSINT and web reconnaissance workflows into a single Python CLI tool, integrating mul
→ GitHub Repo: wagoodman/dive ⭐ 53,872 · Go