Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Commit c7acb1a

Browse files
authored
Merge pull request #113 from nkubala/docs
update docs
2 parents 8ae444a + 7320b9b commit c7acb1a

File tree

1 file changed

+34
-28
lines changed

1 file changed

+34
-28
lines changed

README.md

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@ Status](https://travis-ci.org/GoogleCloudPlatform/container-diff.svg?branch=mast
55

66
## What is container-diff?
77

8-
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:
99
- Docker Image History
1010
- 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.
1715

1816
## Installation
1917

@@ -39,10 +37,10 @@ Download the [container-diff-windows-amd64.exe](https://storage.googleapis.com/c
3937

4038
## Quickstart
4139

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:
4341

4442
```
45-
container-diff analyze <img> [Run all analyzers]
43+
container-diff analyze <img> [Run default analyzers]
4644
container-diff analyze <img> --types=history [History]
4745
container-diff analyze <img> --types=file [File System]
4846
container-diff analyze <img> --types=pip [Pip]
@@ -52,7 +50,7 @@ container-diff analyze <img> --types=apt,node [Apt and Node]
5250
# --types=<analyzer1>,<analyzer2>,<analyzer3>,...
5351
```
5452

55-
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:
5654
```
5755
container-diff diff <img1> <img2> [Run all differs]
5856
container-diff diff <img1> <img2> --types=history [History]
@@ -65,7 +63,7 @@ container-diff diff <img1> <img2> --types=node [Node]
6563
You can similarly run many analyzers at once:
6664

6765
```
68-
container-diff diff <img1> <img2> --types=history,apt,node [History, Apt, and Node]
66+
container-diff diff <img1> <img2> --types=history,apt,node
6967
```
7068

7169
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:
7977
| apt-get installed packages| -a | --apt |
8078

8179

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.
83+
84+
```container-diff diff daemon://modified_debian:latest remote://gcr.io/google-appengine/debian8:latest```
85+
86+
Additionally, tarballs can be provided to the tool directly. Make sure your file has a valid tar extension (.tar, .tar.gz, .tgz).
8287

8388

8489
## Other Flags
@@ -96,27 +101,27 @@ To order files and packages by size (in descending order) when performing file s
96101

97102
## Analysis Result Format
98103

99-
The JSONs for analysis results are in the following format:
104+
JSON output for analysis results is in the following format:
100105
```
101106
{
102107
"Image": "foo",
103108
"AnalyzeType": "Apt",
104109
"Analysis": {},
105110
}
106111
```
107-
The possible structures of the `Analysis` field are detailed below.
112+
The possible contents of the `Analysis` field are detailed below.
108113

109114
### History Analysis
110115

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.
112117

113118
### File System Analysis
114119

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.
116121

117122
### Package Analysis
118123

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:
120125
```
121126
type PackageOutput struct {
122127
Name string
@@ -142,7 +147,7 @@ Here, the `Path` field is included because there may be more than one instance o
142147

143148
## Diff Result Format
144149

145-
The JSONs for diff results are in the following format:
150+
JSON output for diff results is in the following format:
146151
```
147152
{
148153
"Image1": "foo",
@@ -155,7 +160,7 @@ The possible structures of the `Diff` field are detailed below.
155160

156161
### History Diff
157162

158-
The history differ has the following json output structure:
163+
The history differ has the following JSON output structure:
159164

160165
```
161166
type HistDiff struct {
@@ -166,7 +171,7 @@ type HistDiff struct {
166171

167172
### File System Diff
168173

169-
The file system differ has the following json output structure:
174+
The file system differ has the following JSON output structure:
170175

171176
```
172177
type DirDiff struct {
@@ -178,7 +183,7 @@ type DirDiff struct {
178183

179184
### Package Diffs
180185

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:
182187
```
183188
type PackageInfo struct {
184189
Version string
@@ -188,7 +193,7 @@ type PackageInfo struct {
188193

189194
#### Single Version Package Diffs
190195

191-
Single version differs (apt) have the following json output structure:
196+
Single version differs (apt) have the following JSON output structure:
192197

193198
```
194199
type PackageDiff struct {
@@ -198,11 +203,11 @@ type PackageDiff struct {
198203
}
199204
```
200205

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.
202207

203208
#### Multi Version Package Diffs
204209

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:
206211

207212
```
208213
type MultiVersionPackageDiff struct {
@@ -212,7 +217,7 @@ type MultiVersionPackageDiff struct {
212217
}
213218
```
214219

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).
216221

217222
```
218223
type MultiVersionInfo struct {
@@ -224,7 +229,8 @@ type MultiVersionInfo struct {
224229

225230
## Known issues
226231

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)
228234

229235

230236
## Example Run
@@ -259,8 +265,8 @@ Packages found only in gcr.io/google-appengine/python:2017-06-29-190410: None
259265
Version differences: None
260266
261267
```
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:
264270
```
265271
[
266272
{
@@ -338,7 +344,7 @@ Only in image2
338344
```
339345
## Make your own differ
340346

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!
342348

343349
### Custom Analyzer Quickstart
344350

0 commit comments

Comments
 (0)