在「Dive: A tool for exploring a Docker image, layer contents and more (github.com/wagoodman)」這邊看到的工具,官網在 GitHub 上:「wagoodman/dive」。
Docker image 是一層一層疊起來的,而 dive 可以翻出每一層的變化:
A tool for exploring a docker image, layer contents, and discovering ways to shrink the size of your Docker/OCI image.
馬上想得到的用途是拿來分析空間的使用情況,另外可以拿來確認 container 裡面的內容 (就不用 /bin/bash
進去看了)。
在留言 id=38915336 這邊另外提到了 crane 這個有趣的的東西,可以操作 Docker image。
這邊看到的說明包括了合併不同的 layer,以及類似 Git 的 rebase 功能 (re-apply diff):
For image and layer manipulation, crane is awesome - as is the underlying go-containerregistry library.
It lets you add new layers, or edit any metadata (env vars, labels, entrypoint, etc) in existing images. You can also "flatten" an image with multiple layers into a single layer. Additionally you can "rebase" an image (re-apply your changes onto a new/updated base image). It does all this directly in the registry, so no docker needed (though it's still useful for creating the original image).
https://github.com/google/go-containerregistry/blob/main/cmd/crane/recipes.md
(updated: better link)
兩個剛好搭在一起...