You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 27, 2024. It is now read-only.
container-diff is an image analysis command line tool. container-diff can analyze images along several different criteria, currently including:
8
+
container-diff is a tool for analyzing and comparing container images. container-diff can examine images along several different criteria, including:
9
9
- Docker Image History
10
10
- Image file system
11
-
- apt-get installed packages
12
-
- pip installed packages
13
-
- npm installed packages
14
-
The above analyses can be performed on a single image, or a diff can be performed on two images to compare images.
15
-
16
-
This tool can help you as a developer better understand what is changing within your images and better understand what your images contain.
11
+
- Apt packages
12
+
- pip packages
13
+
- npm packages
14
+
These analyses can be performed on a single image, or a diff can be performed on two images to compare. The tool can help users better understand what is changing inside their images, and give them a better look at what their images contain.
17
15
18
16
## Installation
19
17
@@ -39,10 +37,10 @@ Download the [container-diff-windows-amd64.exe](https://storage.googleapis.com/c
39
37
40
38
## Quickstart
41
39
42
-
To use `container-diff analyze` to perform analysis on a single image, you need one Docker image (in the form of an ID, tarball, or URL from a repo). Once you have that image, you can run any of the following analyzers:
40
+
To use `container-diff analyze` to perform analysis on a single image, you need one Docker image (in the form of an ID, tarball, or URL from a repo). Once you have that image, you can run any of the following analyzers:
To use container-diff to perform a diff analysis on two images, you need two Docker images (in the form of an ID, tarball, or URL from a repo). Once you have those images, you can run any of the following differs:
53
+
To use container-diff to perform a diff analysis on two images, you need two Docker images (in the form of an ID, tarball, or URL from a repo). Once you have those images, you can run any of the following differs:
56
54
```
57
55
container-diff diff <img1> <img2> [Run all differs]
All of the analyzer flags with their long versions can be seen below:
@@ -96,27 +94,27 @@ To order files and packages by size (in descending order) when performing file s
96
94
97
95
## Analysis Result Format
98
96
99
-
The JSONs for analysis results are in the following format:
97
+
JSON output for analysis results is in the following format:
100
98
```
101
99
{
102
100
"Image": "foo",
103
101
"AnalyzeType": "Apt",
104
102
"Analysis": {},
105
103
}
106
104
```
107
-
The possible structures of the `Analysis` field are detailed below.
105
+
The possible contents of the `Analysis` field are detailed below.
108
106
109
107
### History Analysis
110
108
111
-
The history analyzer outputs a list of strings representing descriptions of how an image layer was created.
109
+
The history analyzer outputs a list of strings representing descriptions of how an image layer was created. This is the only analyzer that requires a working Docker daemon to run.
112
110
113
111
### File System Analysis
114
112
115
-
The file system analyzer outputs a list of strings representing file system contents.
113
+
The file system analyzer outputs a list of file system contents, including names, paths, and sizes.
116
114
117
115
### Package Analysis
118
116
119
-
Package analyzers such as pip, apt, and node inspect the packages installed within the image provided. All package analyses leverage the PackageOutput struct, which contains the version and size for a given package instance (and a potential installation path for a specific instance of a package where multiple versions are allowed to be installed), as detailed below:
117
+
Package analyzers such as pip, apt, and node inspect the packages installed within the image provided. All package analyses leverage the PackageOutput struct, which contains the version and size for a given package instance (and a potential installation path for a specific instance of a package where multiple versions are allowed to be installed), as detailed below:
120
118
```
121
119
type PackageOutput struct {
122
120
Name string
@@ -142,7 +140,7 @@ Here, the `Path` field is included because there may be more than one instance o
142
140
143
141
## Diff Result Format
144
142
145
-
The JSONs for diff results are in the following format:
143
+
JSON output for diff results is in the following format:
146
144
```
147
145
{
148
146
"Image1": "foo",
@@ -155,7 +153,7 @@ The possible structures of the `Diff` field are detailed below.
155
153
156
154
### History Diff
157
155
158
-
The history differ has the following json output structure:
156
+
The history differ has the following JSON output structure:
159
157
160
158
```
161
159
type HistDiff struct {
@@ -166,7 +164,7 @@ type HistDiff struct {
166
164
167
165
### File System Diff
168
166
169
-
The file system differ has the following json output structure:
167
+
The file system differ has the following JSON output structure:
170
168
171
169
```
172
170
type DirDiff struct {
@@ -178,7 +176,7 @@ type DirDiff struct {
178
176
179
177
### Package Diffs
180
178
181
-
Package differs such as pip, apt, and node inspect the packages contained within the images provided. All packages differs currently leverage the PackageInfo struct which contains the version and size for a given package instance, as detailed below:
179
+
Package differs such as pip, apt, and node inspect the packages contained within the images provided. All packages differs currently leverage the PackageInfo struct which contains the version and size for a given package instance, as detailed below:
182
180
```
183
181
type PackageInfo struct {
184
182
Version string
@@ -188,7 +186,7 @@ type PackageInfo struct {
188
186
189
187
#### Single Version Package Diffs
190
188
191
-
Single version differs (apt) have the following json output structure:
189
+
Single version differs (apt) have the following JSON output structure:
192
190
193
191
```
194
192
type PackageDiff struct {
@@ -198,11 +196,11 @@ type PackageDiff struct {
198
196
}
199
197
```
200
198
201
-
Packages1 and Packages2 detail which packages exist uniquely in Image1 and Image2, respectively, with package name, version and size info. InfoDiff contains a list of Info structs, each of which contains the package name (which occurred in both images but had a difference in size or version), and the PackageInfo struct for each package instance.
199
+
Packages1 and Packages2 detail which packages exist uniquely in Image1 and Image2, respectively, with package name, version and size info. InfoDiff contains a list of Info structs, each of which contains the package name (which occurred in both images but had a difference in size or version), and the PackageInfo struct for each package instance.
202
200
203
201
#### Multi Version Package Diffs
204
202
205
-
The multi version differs (pip, node) support processing images which may have multiple versions of the same package. Below is the json output structure:
203
+
The multi version differs (pip, node) support processing images which may have multiple versions of the same package. Below is the json output structure:
206
204
207
205
```
208
206
type MultiVersionPackageDiff struct {
@@ -212,7 +210,7 @@ type MultiVersionPackageDiff struct {
212
210
}
213
211
```
214
212
215
-
Packages1 and Packages2 detail which packages exist uniquely in Image1 and Image2, respectively, with package name, installation path, version and size info. InfoDiff here is exanded to allow for multiple versions to be associated with a single package. In this case, a package of the same name is considered to differ between two images when there exist one or more instances of it installed in one image but not the other (i.e. have a unique version and/or size).
213
+
Packages1 and Packages2 detail which packages exist uniquely in Image1 and Image2, respectively, with package name, installation path, version and size info. InfoDiff here is exanded to allow for multiple versions to be associated with a single package. In this case, a package of the same name is considered to differ between two images when there exist one or more instances of it installed in one image but not the other (i.e. have a unique version and/or size).
216
214
217
215
```
218
216
type MultiVersionInfo struct {
@@ -224,7 +222,7 @@ type MultiVersionInfo struct {
224
222
225
223
## Known issues
226
224
227
-
To run container-diff on image IDs, docker must be installed.
225
+
To run container-diff using image IDs, docker must be installed.
228
226
229
227
230
228
## Example Run
@@ -259,8 +257,8 @@ Packages found only in gcr.io/google-appengine/python:2017-06-29-190410: None
259
257
Version differences: None
260
258
261
259
```
262
-
## Example Run with json post-processing
263
-
The following example demonstrates how one might selectively display the output of their diff, such that version differences are ignored and only package absence/presence is displayed and the packages present in only one image are sorted by size in descending order. A small piece of the json being post-processed can be seen below:
260
+
## Example Run with JSON post-processing
261
+
The following example demonstrates how one might selectively display the output of their diff, such that version differences are ignored and only package absence/presence is displayed and the packages present in only one image are sorted by size in descending order. A small piece of the JSON being post-processed can be seen below:
264
262
```
265
263
[
266
264
{
@@ -338,7 +336,7 @@ Only in image2
338
336
```
339
337
## Make your own differ
340
338
341
-
Feel free to develop your own analyzer leveraging the utils currently available. PRs are welcome.
339
+
Feel free to develop your own analyzer leveraging the utils currently available. PRs are welcome!
0 commit comments