How to analyze the file size between two different Docker Images?

In this blog, we are going to analyze and compare the file size between two Container images using Container Diff tool.

What is container-diff?

container-diff is a developed by Google to analyze and compare container images. We can use this tool to get the difference between multiple images or analyze the data on single image as well.

It is not currently being officially supported  by Google but we can use it to get the data.

Installation

macOS

curl -LO https://storage.googleapis.com/container-diff/latest/container-diff-darwin-amd64

sudo install container-diff-darwin-amd64 /usr/local/bin/container-diff

Linux

curl -LO https://storage.googleapis.com/container-diff/latest/container-diff-linux-amd64

sudo install container-diff-linux-amd64 /usr/local/bin/container-diff

Windows

Download the container-diff-windows-amd64.exe file, rename it to container-diff.exe and add it to your path.

To perform analysis on Single Image

container-diff analyze <img> --type=history  [History]

container-diff analyze <img> --type=file  [File System]

container-diff analyze <img> --type=size  [Size]

container-diff analyze <img> --type=rpm  [RPM]

container-diff analyze <img> --type=pip  [Pip]

container-diff analyze <img> --type=apt  [Apt]

container-diff analyze <img> --type=node  [Node]

container-diff analyze <img> --type=apt --type=node  [Apt and Node]

You can provide image name in the form of an ID, tarball, or URL from a repo.

To perform analysis on Multiple Images

container-diff diff <img1> <img2> --type=history  [History]

container-diff diff <img1> <img2> --type=file  [File System]

container-diff diff <img1> <img2> --type=size  [Size]

container-diff diff <img1> <img2> --type=rpm  [RPM]

container-diff diff <img1> <img2> --type=pip  [Pip]

container-diff diff <img1> <img2> --type=apt  [Apt]

container-diff diff <img1> <img2> --type=node  [Node]

Here, we need to provide the images name in the form of an ID, tarball, or URL from a repo like above.


Comments

Popular posts from this blog

How to update build number in Azure DevOps pipeline?

How to get latest build ID from Azure DevOps pipeline?

How to install AWS System Manager (SSM) Agent on windows using PowerShell?