使用
安裝前先知道:有已知漏洞
pickfit 在安裝時會一併裝上的套件裡找到 1 個已知的高風險或嚴重漏洞(OSV.dev,2026年11月5日),安裝前請先考慮。
go:github.com/go-jose/go-jose/v4 v4.1.5Go JOSE:解析包含 RSA 金鑰的 JWK 時發生 DoS (GHSA-mgcc-cww5-fp2q,高風險,4.1.6 已修正)
Linux x86_64
從 GitHub releases 下載 dive v0.13.1 linux_amd64 tarball 並安裝至 ~/.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
確認能用
dive --version輸出應包含「dive 0.13.1」。
先試試這個
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.json它能做什麼
- 標示各圖層的變更內容已測試
- 估算映像檔效率與浪費空間已測試
- 依圖層顯示 Docker 映像檔內容沒有看到它可用
- 建置映像檔並立即分析未測試
pickfit 測到哪一步
Linux x86_64
- 可以安裝
- 可以啟動
- 4 項功能中 2 項可用
- 可離線使用
適合用來
- 依圖層瀏覽 Docker 映像檔內容
- 估算映像檔效率與浪費空間
pickfit 怎麼測的
每次測試都從乾淨的機器開始,照上面的步驟執行。 pickfit 怎麼驗證
Linux x86_64
主要功能可用
- 從頭重跑
- 可離線使用
- 檢查於 2026年11月4日
- 版本 0.13.1
測試機器遇到的差異
- README: Install via go install or pacman -S dive (and brew/docker)
測試中: 在沒有 Go/Docker 的 Debian 上,從 GitHub releases 下載預先建置的 linux_amd64 tarball 並解壓縮至 ~/.local/bin - README: dive nginx:latest uses Docker daemon by default
測試中: 使用 --source docker-archive 搭配自製的 docker save tarball 在無 Docker daemon 的情況下測試;v0.13.1 中無 registry 來源 - README: dive build builds via Docker
測試中: dive build 需要 docker 用戶端執行檔;缺少時會優雅地失敗