TiloBox
Back to directory
dive project preview

dive

A terminal tool for examining Docker or OCI image layers, file changes, and wasted space.

LicenseMIT
GitHub stars54.5k
Last commit8 months ago
Tags7 topics
Image AnalysisCliSelf HostedOpen SourceContainersDockerTerminal Ui
Overview

Why consider dive?

Dive is an open-source terminal tool for exploring Docker and OCI image layers, discovering file modifications across builds, and identifying wasted space to shrink container sizes.

Guided learning

Learn dive by building

Practical setup notes, real use cases, and copy-ready examples in one focused guide.

3 min read 3 sections
In this guide3 sections

Inspecting and Optimizing Container Images with Dive

When building containerized applications, image size directly impacts deployment latency, network transfer times, and storage overhead. Unintentional bloat often creeps into container images when build steps create intermediate artifacts, duplicate assets across layers, or fail to clean up package manager caches within the same RUN instruction. According to the official README, Dive is a tool for exploring a Docker image, layer contents, and discovering ways to shrink the size of your Docker/OCI image.

The project is hosted in the Dive GitHub Repository and is made available under the open-source MIT License. It provides both an interactive terminal user interface (TUI) and an automated non-interactive continuous integration mode.

Layer Inspection and File Tree Navigation

Container images are composed of stacked filesystem layers. Understanding what is introduced at each layer is necessary when diagnosing unexpected bloat. In Dive's interactive mode, the terminal interface splits the display into distinct functional areas:

  • Layer Breakdown: As you select a layer on the left, you are shown the contents of that layer combined with all previous layers on the right. You can navigate through the layer history to see how each Dockerfile instruction modified the root filesystem.
  • File Tree State: Files that have changed, been modified, added, or removed are indicated in the file tree. This color-coded and marked view makes it immediately clear whether an instruction unintentionally modified permissions or created unexpected temporary files.
  • Space Utilization Metrics: The lower left pane shows basic layer info and an experimental metric that will guess how much wasted space your image contains. This calculation highlights duplicate files across layers, moved paths, and incomplete removals.

Navigating the filesystem view allows developers to trace individual large files back to the exact Dockerfile line responsible for generating them.

Analyzing Images with the Command-Line Interface

You can analyze local images directly using the standalone binary or by running Dive through Docker without permanent host installation.

To analyze an existing image on your local machine, run the tool with an image tag:

bash
1dive <your-image-tag>

For teams that prefer not to install the binary natively, Dive can run as a temporary container sharing the host Docker daemon socket:

bash
1docker run -ti --rm -v /var/run/docker.sock:/var/run/docker.sock docker.io/wagoodman/dive nginx:latest

Dive also supports building and analyzing in a single unified step with dive build -t <tag> ., substituting standard docker build commands during local iteration loops.

Automated CI Pipeline Integration

Interactive inspection is effective for manual debugging, but preventing regressions requires automated enforcement during pull request verification. Dive allows teams to evaluate container images programmatically in CI pipelines without launching the terminal user interface.

Setting the CI=true environment variable instructs Dive to run non-interactively:

bash
1CI=true dive <your-image>

In this mode, Dive will analyze an image and get a pass/fail result based on the image efficiency and wasted space. When configured alongside custom threshold rules in .dive.yaml—such as maximum allowable wasted bytes or minimum required efficiency ratios—Dive can automatically exit with a non-zero exit code to fail continuous integration builds whenever an image violates size policies.

Related tools

More options with a similar category or technology profile.

dive FAQs

dive is listed as a Developer Tools tool on TiloBox. Review the overview, features, and official documentation on this page to decide whether it solves your specific workflow.

Start with the project's GitHub repository for supported installation and deployment instructions. Test the setup with representative data or a small project before rolling it out more widely.

dive is listed under the MIT license. Read the complete license text and the project's notices before using, modifying, or distributing the software.

Production readiness depends on your requirements. Review maintenance activity, security practices, documentation, backup and upgrade procedures, and compatibility with your stack; then validate it in a non-production environment.

dive is listed as an alternative to Docker Desktop. Compare the core workflow, deployment model, integrations, and licensing against your must-have requirements before switching.