container-diff

container image analysis and comparison

TLDR

Analyze image size
$ container-diff analyze [image:tag]
Diff two images for apt packages
$ container-diff diff [image1] [image2] --type=apt
Diff pip packages
$ container-diff diff [image1] [image2] --type=pip
Diff filesystem changes
$ container-diff diff [image1] [image2] --type=file
Compare multiple analyzers
$ container-diff diff [image1] [image2] --type=apt --type=pip --type=node
Output as JSON
$ container-diff diff [image1] [image2] --type=apt -j
Compare local and remote
$ container-diff diff daemon://[local:tag] remote://[repo/image:tag]

SYNOPSIS

container-diff command [options] image...

DESCRIPTION

container-diff is a tool for analyzing and comparing container images at a semantic level. Rather than just showing raw filesystem differences, it understands package managers and can report changes in terms of actual packages (apt, pip, npm), making it easier to understand what changed between image versions.The tool supports multiple image sources including local Docker daemon images, remote registry images, and tarball archives. It can analyze a single image or compare two images, with output available in human-readable or JSON formats for integration with CI/CD pipelines.Developed by Google as part of their Container Tools suite, container-diff helps with debugging image bloat, understanding layer contents, and validating that builds produce expected changes. It's particularly useful for security auditing and optimizing Docker images.

PARAMETERS

--type analyzer

Analyzer type: apt, rpm, pip, node, file, size, history.
-j, --json
Output as JSON.
-o, --order
Sort results by size in descending order.
-q, --quiet
Suppress output to stderr.
-c, --cache dir
Cache directory.
--filename path
Compare specific file.

COMMANDS

analyze

Analyze single image
diff
Compare two images

IMAGE SOURCES

daemon://image: Local Docker daemonremote://image: Remote registrypath/to/image.tar: Local tarball

ANALYZERS

apt: Debian/Ubuntu packagesrpm: Red Hat/CentOS packagespip: Python packagesnode: npm packagesfile: Filesystem differencessize: Image sizehistory: Layer history

INSTALL

sudo pacman -S container-diff
sudo zypper install container-diff

CAVEATS

The project was archived in March 2024 and is no longer actively maintained. Does not support Docker IDs directly (tag first). Use docker-credential-helpers for registry auth. Without --type, defaults to size analysis.

SEE ALSO

docker(1), skopeo(1), dive(1)