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:
@@ -79,6 +77,13 @@ All of the analyzer flags with their long versions can be seen below:
79
77
| apt-get installed packages| -a | --apt |
80
78
81
79
80
+
## Image Sources
81
+
82
+
container-diff supports Docker images located in both a local Docker daemon and a remote registry. To explicitly specify a local image, use the `daemon://` prefix on the image name; similarly, for an explicitly remote image, use the `remote://` prefix.
Additionally, tarballs can be provided to the tool directly. Make sure your file has a valid tar extension (.tar, .tar.gz, .tgz).
82
87
83
88
84
89
## Other Flags
@@ -96,27 +101,27 @@ To order files and packages by size (in descending order) when performing file s
96
101
97
102
## Analysis Result Format
98
103
99
-
The JSONs for analysis results are in the following format:
104
+
JSON output for analysis results is in the following format:
100
105
```
101
106
{
102
107
"Image": "foo",
103
108
"AnalyzeType": "Apt",
104
109
"Analysis": {},
105
110
}
106
111
```
107
-
The possible structures of the `Analysis` field are detailed below.
112
+
The possible contents of the `Analysis` field are detailed below.
108
113
109
114
### History Analysis
110
115
111
-
The history analyzer outputs a list of strings representing descriptions of how an image layer was created.
116
+
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
117
113
118
### File System Analysis
114
119
115
-
The file system analyzer outputs a list of strings representing file system contents.
120
+
The file system analyzer outputs a list of file system contents, including names, paths, and sizes.
116
121
117
122
### Package Analysis
118
123
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:
124
+
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
125
```
121
126
type PackageOutput struct {
122
127
Name string
@@ -142,7 +147,7 @@ Here, the `Path` field is included because there may be more than one instance o
142
147
143
148
## Diff Result Format
144
149
145
-
The JSONs for diff results are in the following format:
150
+
JSON output for diff results is in the following format:
146
151
```
147
152
{
148
153
"Image1": "foo",
@@ -155,7 +160,7 @@ The possible structures of the `Diff` field are detailed below.
155
160
156
161
### History Diff
157
162
158
-
The history differ has the following json output structure:
163
+
The history differ has the following JSON output structure:
159
164
160
165
```
161
166
type HistDiff struct {
@@ -166,7 +171,7 @@ type HistDiff struct {
166
171
167
172
### File System Diff
168
173
169
-
The file system differ has the following json output structure:
174
+
The file system differ has the following JSON output structure:
170
175
171
176
```
172
177
type DirDiff struct {
@@ -178,7 +183,7 @@ type DirDiff struct {
178
183
179
184
### Package Diffs
180
185
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:
186
+
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
187
```
183
188
type PackageInfo struct {
184
189
Version string
@@ -188,7 +193,7 @@ type PackageInfo struct {
188
193
189
194
#### Single Version Package Diffs
190
195
191
-
Single version differs (apt) have the following json output structure:
196
+
Single version differs (apt) have the following JSON output structure:
192
197
193
198
```
194
199
type PackageDiff struct {
@@ -198,11 +203,11 @@ type PackageDiff struct {
198
203
}
199
204
```
200
205
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.
206
+
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
207
203
208
#### Multi Version Package Diffs
204
209
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:
210
+
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
211
207
212
```
208
213
type MultiVersionPackageDiff struct {
@@ -212,7 +217,7 @@ type MultiVersionPackageDiff struct {
212
217
}
213
218
```
214
219
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).
220
+
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
221
217
222
```
218
223
type MultiVersionInfo struct {
@@ -224,7 +229,8 @@ type MultiVersionInfo struct {
224
229
225
230
## Known issues
226
231
227
-
To run container-diff on image IDs, docker must be installed.
232
+
To run container-diff using image IDs, docker must be installed.
233
+
Tarballs provided directly to the tool must be in the Docker format (i.e. have a manifest.json file for layer ordering)
228
234
229
235
230
236
## Example Run
@@ -259,8 +265,8 @@ Packages found only in gcr.io/google-appengine/python:2017-06-29-190410: None
259
265
Version differences: None
260
266
261
267
```
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:
268
+
## Example Run with JSON post-processing
269
+
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
270
```
265
271
[
266
272
{
@@ -338,7 +344,7 @@ Only in image2
338
344
```
339
345
## Make your own differ
340
346
341
-
Feel free to develop your own analyzer leveraging the utils currently available. PRs are welcome.
347
+
Feel free to develop your own analyzer leveraging the utils currently available. PRs are welcome!
0 commit comments