# dive

> Docker image layer analysis tool for exploring contents and optimizing image size

Stars: 54.7k · Language: Go · License: MIT · Categories: Dev Tools

- Repository: https://github.com/wagoodman/dive
- Page: https://www.trmn.sh/tools/dive

## Install

- Homebrew: `brew install dive`
- Go: `go install github.com/wagoodman/dive@latest`
- Docker: `docker pull docker.io/wagoodman/dive`

## Overview

dive is a Docker image analysis tool that provides layer-by-layer exploration of container images. It displays the file tree contents of each layer, allowing users to navigate through files and directories using keyboard controls. The tool highlights file changes across layers, showing which files have been added, modified, or removed.

The tool calculates image efficiency metrics and estimates wasted space caused by duplicate files, unnecessary layer changes, or incomplete file removals. It provides both a percentage efficiency score and total wasted bytes measurement. Users can analyze images interactively through a terminal UI or integrate it into CI pipelines by setting CI=true to get pass/fail results based on configurable efficiency thresholds.

dive supports multiple container engines including Docker and Podman, and can analyze images from various sources including docker-archive files. It includes a build-and-analyze workflow with the `dive build` command, replacing standard docker build commands for immediate analysis. The tool works across Linux, macOS, and Windows platforms.

### Installation

```bash
# via Homebrew
brew install dive
```

```bash
# via Go
go install github.com/wagoodman/dive@latest
```

```bash
# via Docker
docker pull docker.io/wagoodman/dive
```

![dive TUI showing Docker image layer analysis](https://media.trmn.sh/cached/8e20578a58e3bef5e79da50426b0bb6817b09685cd15b46e9b412f6bd3667896.gif)

![dive interface displaying image efficiency metrics](https://media.trmn.sh/cached/075d076596b4aa2db6362cd8f7970c39e0e6b0e44cda4611cfc4b673476efe98.png)

## Alternatives

- [lazydocker](https://www.trmn.sh/tools/lazydocker.md): Terminal UI for Docker and Docker Compose management with container logs, stats, and interactive controls (Go, 53.2k stars)
- [Terraform](https://www.trmn.sh/tools/terraform.md): Infrastructure-as-code CLI that builds, changes, and versions infrastructure from declarative configuration files, using execution plans and a resource graph. (Go, 50.3k stars)
- [mkcert](https://www.trmn.sh/tools/mkcert.md): Generate locally-trusted development certificates with automatic CA management for HTTPS testing (Go, 59.8k stars)
- [trivy](https://www.trmn.sh/tools/trivy.md): Security scanner that detects vulnerabilities, secrets, and misconfigurations in containers, filesystems, git repos, VMs, and Kubernetes (Go, 38.9k stars)
- [act](https://www.trmn.sh/tools/act.md): Run GitHub Actions workflows locally using Docker containers for fast feedback and testing (Go, 72.5k stars)

## Guides

- [Best Docker TUIs](https://www.trmn.sh/best/docker-tuis): Compare lazydocker, ducker, dtop, dive and ctop: Docker TUIs for containers, Compose, logs, stats and image layer analysis.

---

Canonical: https://www.trmn.sh/tools/dive
