dive
Tool for exploring Docker image layers and finding ways to shrink size.
Tested on LinuxKnown vulnerabilities
Use it
Before you install: known vulnerabilities
pickfit found 1 known high or critical vulnerability in the packages a fresh install brings (OSV.dev, 5 Nov 2026). Weigh this before you install it.
go:github.com/go-jose/go-jose/v4 v4.1.5Go JOSE: DoS when parsing JWKs that contain RSA keys (GHSA-mgcc-cww5-fp2q, high, fixed in 4.1.6)
Linux x86_64
Download dive v0.13.1 linux_amd64 tarball from GitHub releases and install to ~/.local/bin
DIVE_VERSION=0.13.1 curl -fL "https://github.com/wagoodman/dive/releases/download/v${DIVE_VERSION}/dive_${DIVE_VERSION}_linux_amd64.tar.gz" -o /tmp/dive.tar.gz mkdir -p ~/.local/bin tar -xzf /tmp/dive.tar.gz -C /tmp && mv /tmp/dive ~/.local/bin/dive && chmod +x ~/.local/bin/dive && ~/.local/bin/dive --version
Check that it works
dive --versionThe output should contain “dive 0.13.1”.
First thing to try
cat > /tmp/make_archive.py <<'PYEOF'
import tarfile, json, os, io, tempfile, hashlib
tmpdir = "/tmp/dive-image"
os.makedirs(tmpdir, exist_ok=True)
# Create two layers to test layer diff
# Layer 1: contains /hello.txt
# Layer 2: adds /world.txt and modifies /hello.txt
def make_layer_tar(files, path):
buf = io.BytesIO()
with tarfile.open(fileobj=buf, mode='w') as tf:
for name, content in files.items():
data = content.encode()
ti = tarfile.TarInfo(name=name)
ti.size = len(data)
ti.mtime = 0
tf.addfile(ti, io.BytesIO(data))
data = buf.getvalue()
with open(path, 'wb') as f:
f.write(data)
return hashlib.sha256(data).hexdigest()
layer1_hash = make_layer_tar({"hello.txt": "hello from layer1\n"}, "/tmp/dive-image/layer1.tar")
layer2_hash = make_layer_tar({"world.txt": "hello world\n", "hello.txt": "modified hello\n"}, "/tmp/dive-image/layer2.tar")
# Create config json
config = {
"architecture": "amd64",
"os": "linux",
"rootfs": {"type": "layers", "diff_ids": [f"sha256:{layer1_hash}", f"sha256:{layer2_hash}"]},
"history": [{"created": "2025-01-01T00:00:00Z"}, {"created": "2025-01-02T00:00:00Z"}],
"config": {}
}
import hashlib as hl
config_data = json.dumps(config).encode()
config_hash = hl.sha256(config_data).hexdigest()
with open(f"/tmp/dive-image/{config_hash}.json", "wb") as f:
f.write(config_data)
# manifest.json
manifest = [{
"Config": f"{config_hash}.json",
"RepoTags": ["test:latest"],
"Layers": ["layer1.tar", "layer2.tar"]
}]
with open("/tmp/dive-image/manifest.json", "w") as f:
json.dump(manifest, f)
with open("/tmp/dive-image/repositories", "w") as f:
json.dump({"test": {"latest": "layer2"}}, f)
# Create docker save tarball
with tarfile.open("/tmp/test-image.tar", "w") as out:
for fname in ["manifest.json", "repositories", f"{config_hash}.json", "layer1.tar", "layer2.tar"]:
out.add(f"/tmp/dive-image/{fname}", arcname=fname)
print(f"Created /tmp/test-image.tar with layers {layer1_hash[:12]}, {layer2_hash[:12]}, config {config_hash[:12]}")
print(f"Size: {os.path.getsize('/tmp/test-image.tar')}")
PYEOF
python3 /tmp/make_archive.py
tar -tvf /tmp/test-image.tardive --source docker-archive /tmp/test-image.tar --json /tmp/dive-output.jsonWhat it does
- Indicate what changed in each layerTested
- Estimate image efficiency and wasted spaceTested
- Show Docker image contents by layerNot shown working
- Build image and analyze immediatelyNot tested
How far pickfit got
Linux x86_64
- Installs
- Starts
- 2 of 4 features work
- Works offline
Good for
- explore Docker image contents broken down by layer
- estimate image efficiency and wasted space
How pickfit tested it
Each run starts from a clean machine and follows the steps above. How pickfit verifies
Linux x86_64
Its main function works
- Replayed from scratch
- Works offline
- Checked on 4 Nov 2026
- Version 0.13.1
Differences the test machine hit
- README: Install via go install or pacman -S dive (and brew/docker)
In the test: On Debian without Go/Docker, downloaded prebuilt linux_amd64 tarball from GitHub releases and extracted to ~/.local/bin - README: dive nginx:latest uses Docker daemon by default
In the test: Used --source docker-archive with a crafted docker save tarball to test without Docker daemon; registry source not available in v0.13.1 - README: dive build builds via Docker
In the test: dive build requires docker client executable; fails gracefully when absent