wagoodman /dive

A tool for exploring each layer in a docker image

★ 54,712⑂ 2,011👁 364⑃ 339● 378▤ 28◈ 0
GoMITCreated 2018-05-13
54,712
stars
+4
2,011
forks
364
watchers
339
prs
378
issues
28
releases
0
discussions

README

dive






A tool for exploring a Docker image, layer contents, and discovering ways to shrink the size of your Docker/OCI image.


!Image

To analyze a Docker image simply run dive with an image tag/id/digest:
bash
dive 


or you can dive with Docker directly:

alias dive="docker run -ti --rm  -v /var/run/docker.sock:/var/run/docker.sock docker.io/wagoodman/dive"
dive 

 for example
dive nginx:latest


or if you want to build your image then jump straight into analyzing it:
bash
dive build -t  .


Building on macOS (supporting only the Docker container engine):

bash
docker run --rm -it \
      -v /var/run/docker.sock:/var/run/docker.sock \
      -v  "$(pwd)":"$(pwd)" \
      -w "$(pwd)" \
      -v "$HOME/.dive.yaml":"$HOME/.dive.yaml" \
      docker.io/wagoodman/dive:latest build -t  .


Additionally you can run this in your CI pipeline to ensure you're keeping wasted space to a minimum (this skips the UI):

CI=true dive 


!Image

This is beta quality! Feel free to submit an issue if you want a new feature or find a bug :)

 Basic Features

Show Docker image contents broken down by layer

As you select a layer on the left, you are shown the contents of that layer combined with all previous layers on the right. Also, you can fully explore the file tree with the arrow keys.

Indicate what's changed in each layer

Files that have changed, been modified, added, or removed are indicated in the file tree. This can be adjusted to show changes for a specific layer, or aggregated changes up to this layer.

Estimate "image efficiency"

The lower left pane shows basic layer info and an experimental metric that will guess how much wasted space your image contains. This might be from duplicating files across layers, moving files across layers, or not fully removing files. Both a percentage "score" and total wasted file space is provided.

Quick build/analysis cycles

You can build a Docker image and do an immediate analysis with one command:
dive build -t some-tag .

You only need to replace your docker build command with the same dive build
command.

CI Integration

Analyze an image and get a pass/fail result based on the image efficiency and wasted space. Simply set CI=true in the environment when invoking any valid dive command.

Multiple Image Sources and Container Engines Supported

With the --source option, you can select where to fetch the container image from:
bash
dive  --source 

or prefix the image with a :// scheme:
bash
dive ://

The file based sources also take the : form other anchore tools use (e.g. dive oci-dir:./layout).
For every other source a single colon is read as an image name and tag, so dive docker:dind analyzes the
docker:dind image.

Source | Reads the image from
-------|---------------------
docker | the Docker engine (the default). Images missing locally are pulled through the docker API, with credentials from your docker config. DOCKER_HOST, DOCKER_CONTEXT and the current docker context are honored
podman | Podman. On linux t

Top issues

Latest release

v0.13.1 v0.13.1 2025-03-29
Bug Fixes                                                                                                                                                                                           

-  Fix layer selection to select only one layer at a time [585  @wagoodman] 
-  Gitlab-ci integration is broken with latest docker image [580  586  @wagoodman]
-  Failed to Create Container After Upgrading to 0.13.0 [576 586 @wagoodman]
-  exec: "getent": executable file not found in $PATH [582  586 @wagoodman]
-  Publish dive to ghcr.io [573  577  @wagoodman]  

 Additional Changes         

Snapshot: 2026-11-10T09:35:25Z · Data license Apache-2.0 · JSON