container-diff 是 Google 开源的一个分析和比较容器镜像的工具,可用来分析 Docker 镜像之间的差异。
container-diff 可通过几个不同的标准(角度)来检查镜像,包括:
-
Docker 镜像历史
-
镜像文件系统
-
Apt 包管理器
-
pip 包管理器
-
npm 包管理器
Installation
macOS
curl -LO https://storage.googleapis.com/container-diff/latest/container-diff-darwin-amd64 && chmod +x container-diff-darwin-amd64 && sudo mv container-diff-darwin-amd64 /usr/local/bin/container-diff
Linux
curl -LO https://storage.googleapis.com/container-diff/latest/container-diff-linux-amd64 && chmod +x container-diff-linux-amd64 && sudo mv container-diff-linux-amd64 /usr/local/bin/container-diff
不想使用 sudo 的话还可以这样
curl -LO https://storage.googleapis.com/container-diff/latest/container-diff-linux-amd64 && chmod +x container-diff-linux-amd64 && mkdir $HOME/bin && export PATH=$PATH:$HOME/bin && mv container-diff-linux-amd64 $HOME/bin/container-diff
Windows
下载 container-diff-windows-amd64.exe 文件,重命名为 container-diff.exe
并将其添加到路径。
Quickstart
单个分析:
container-diff analyze [Run default analyzers] container-diff analyze --type=history [History] container-diff analyze --type=file [File System] container-diff analyze --type=pip [Pip] container-diff analyze --type=apt [Apt] container-diff analyze --type=node [Node] container-diff analyze --type=apt --type=node [Apt and Node] # --type=--type= --type= ,...
多个对比:
container-diff diff[Run default differs] container-diff diff --type=history [History] container-diff diff --type=file [File System] container-diff diff --type=pip [Pip] container-diff diff --type=apt [Apt] container-diff diff --type=node [Node]