Coder Social home page Coder Social logo

container-diff's Introduction

This project is archived.

  • If you wish to continue maintaining it, you may fork and continue development on that fork.
  • If you are looking for an alternative, try diffoci

Build Status

What is container-diff?

container-diff is a tool for analyzing and comparing container images. container-diff can examine images along several different criteria, including:

  • Docker Image History
  • Image file system
  • Image size
  • Apt packages
  • RPM packages
  • pip packages
  • npm packages

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.

NOTE: container-diff is a Google project, but is not currently being officially supported by Google and is in maintenance mode. However, contributions are still welcome and encouraged!

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

OR, if you want to avoid using sudo:

curl -LO https://storage.googleapis.com/container-diff/latest/container-diff-linux-amd64 && \
mkdir -p "$HOME/bin" && export PATH="$PATH:$HOME/bin" && \
install container-diff-linux-amd64 $HOME/bin/container-diff

There is also an Arch Linux package. You can install by running:

pacman -S container-diff

Windows

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

Quickstart

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:

container-diff analyze <img>     [Run default analyzers]
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]
# --type=<analyzer1> --type=<analyzer2> --type=<analyzer3>,...

By default, with no --type flag specified, container-diff will run image size analysis.

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:

container-diff diff <img1> <img2>     [Run default differs]
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]

You can similarly run many analyzers at once:

container-diff diff <img1> <img2> --type=history --type=apt --type=node

To view the diff of an individual file in two different images, you can use the filename flag in conjuction with the file system diff analyzer.

container-diff diff <img1> <img2> --type=file --filename=/path/to/file

Image Sources

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.

container-diff diff daemon://modified_debian:latest remote://gcr.io/google-appengine/debian8:latest

Additionally, tarballs can be provided to the tool directly. Make sure your file has a valid tar extension (.tar, .tar.gz, .tgz).

Note: container-diff does not support references images by Docker ID directly. If your image only has an ID in your local Docker daemon, you'll need to tag it using docker tag before using it with container-diff.

Authentication

Container-diff supports docker-credential-helpers for authentication when using a registry as an image source. Make sure you have your credential helper configured before using container-diff, and it should work automatically.

For the Google Container Registry, make sure you have the docker-credential-gcr binary configured and on your path, following these instructions.

Other Flags

To get a JSON version of the container-diff output add a -j or --json flag.

container-diff diff --type=file --json gcr.io/gcp-runtimes/multi-base gcr.io/gcp-runtimes/multi-modified

To order files and packages by size (in descending order) when performing file system or package analyses/diffs, add a -o or --order flag.

container-diff analyze remote://gcr.io/gcp-runtimes/multi-modified --type=pip --order

To suppress output to stderr, add a -q or --quiet flag.

container-diff analyze file1.tar --type=file --quiet

Analysis Result Format

JSON output for analysis results is in the following format:

{
    "Image": "foo",
    "AnalyzeType": "Apt",
    "Analysis": {}
}

The possible contents of the Analysis field are detailed below.

History Analysis

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.

File System Analysis

The file system analyzer outputs a list of file system contents, including names, paths, and sizes.

Package Analysis

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:

type PackageOutput struct {
	Name    string
	Path    string
	Version string
	Size    int64
}

Single Version Package Analysis

Single version package analyzers (apt) have the following output structure: []PackageOutput

Here, the Path field is omitted because there is only one instance of each package.

Multi Version Package Analysis

Multi version package analyzers (pip, node) have the following output structure: []PackageOutput

Here, the Path field is included because there may be more than one instance of each package, and thus the path exists to pinpoint where the package exists in case additional investigation into the package instance is desired.

Diff Result Format

JSON output for diff results is in the following format:

{
    "Image1": "foo",
    "Image2": "bar",
    "DiffType": "Apt",
    "Diff": {}
}

The possible structures of the Diff field are detailed below.

History Diff

The history differ has the following output structure:

type HistDiff struct {
	Adds []string
	Dels []string
}

File System Diff

The file system differ has the following output structure:

type DirDiff struct {
	Adds  []string
	Dels  []string
	Mods  []string
}

Package Diffs

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:

type PackageInfo struct {
	Version string
	Size	string
}

Single Version Package Diffs

Single version differs (apt) have the following JSON output structure:

type PackageDiff struct {
	Packages1 []PackageOutput
	Packages2 []PackageOutput
	InfoDiff  []Info
}

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.

Multi Version Package Diffs

The multi version differs (pip, node) support processing images which may have multiple versions of the same package. Below is the json output structure:

type MultiVersionPackageDiff struct {
	Packages1 []PackageOutput
	Packages2 []PackageOutput
	InfoDiff  []MultiVersionInfo
}

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

type MultiVersionInfo struct {
	Package string
	Info1	[]PackageInfo
	Info2	[]PackageInfo
}

User Customized Output

Users can customize the format of the output of diffs with the--format flag. The flag takes a Go template string, which specifies the format the diff should be output in. This template string uses the structs described above, depending on the differ used, to format output. The default template strings container-diff uses can be found here.

An example using the pip package analyzer is shown below, in which only package names are printed (some are repeated because of version differences).

$ container-diff analyze gcr.io/google-appengine/python:latest --type=pip --format='
-----{{.AnalyzeType}}-----
Packages found in {{.Image}}:{{if not .Analysis}} None{{else}}
{{range .Analysis}}{{"\n"}}{{.Name}}{{end}}
{{end}}
'
Retrieving image gcr.io/google-appengine/python:latest from source Cloud Registry
Retrieving analyses

-----Pip-----
Packages found in gcr.io/google-appengine/python:latest:

chardet
colorama
html5lib
mercurial
pip
pip
pip
requests
setuptools
setuptools
setuptools
six
urllib3
virtualenv
wheel
wheel

Known issues

To run container-diff using image IDs, docker must be installed. Tarballs provided directly to the tool must be in the Docker format (i.e. have a manifest.json file for layer ordering)

Example Run

$ container-diff diff gcr.io/google-appengine/python:2017-07-21-123058 gcr.io/google-appengine/python:2017-06-29-190410 --type=apt --type=node --type=pip

-----AptDiffer-----

Packages found only in gcr.io/google-appengine/python:2017-07-21-123058: None

Packages found only in gcr.io/google-appengine/python:2017-06-29-190410: None

Version differences:
PACKAGE             IMAGE1 (gcr.io/google-appengine/python:2017-07-21-123058)        IMAGE2 (gcr.io/google-appengine/python:2017-06-29-190410)
-libgcrypt20        1.6.3-2 deb8u4, 998K                                             1.6.3-2 deb8u3, 1002K

-----NodeDiffer-----

Packages found only in gcr.io/google-appengine/python:2017-07-21-123058: None

Packages found only in gcr.io/google-appengine/python:2017-06-29-190410: None

Version differences: None

-----PipDiffer-----

Packages found only in gcr.io/google-appengine/python:2017-07-21-123058: None

Packages found only in gcr.io/google-appengine/python:2017-06-29-190410: None

Version differences: None
$ container-diff diff file1.tar file2.tar --type=file --filename=go/src/app/file.txt
Starting diff on images file1.tar and file2.tar, using differs: [file]
Retrieving image file2.tar from source Tar Archive
Retrieving image file1.tar from source Tar Archive
Computing diffs

-----File-----

These entries have been added to file1.tar: None

These entries have been deleted from file1.tar: None

These entries have been changed between file1.tar and file2.tar:
FILE                        SIZE1        SIZE2
/go/src/app/file.txt        30B          30B

Computing filename diffs

-----Diff of go/src/app/file.txt-----


--- file1.tar
+++ file2.tar
@@ -1 +1 @@
-This is file 1
This is a file
+This is file 2
This is a file

Example Run with JSON post-processing

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:

[
  {
    "DiffType": "AptDiffer",
    "Diff": {
      "Image1": "gcr.io/gcp-runtimes/multi-base",
      "Packages1": {},
      "Image2": "gcr.io/gcp-runtimes/multi-modified",
      "Packages2": {
        "dh-python": {
          "Version": "1.20141111-2",
          "Size": "277"
        },
        "libmpdec2": {
          "Version": "2.4.1-1",
          "Size": "275"
        }
      }
    }
  }
]

The post-processing script used for this example is below:

import sys, json

def main():
  data = json.loads(sys.stdin.read())
  img1packages = []
  img2packages = []
  for differ in data:
    diff = differ['Diff']

    if len(diff['Packages1']) > 0:
      for package in diff['Packages1']:
        Size = package['Size']
        img1packages.append((str(package), int(str(Size))))

    if len(diff['Packages2']) > 0:
      for package in diff['Packages2']:
        Size = package['Size']
        img2packages.append((str(package), int(str(Size))))

    img1packages = reversed(sorted(img1packages, key=lambda x: x[1]))
    img2packages = reversed(sorted(img2packages, key=lambda x: x[1]))


    print "Only in image1\n"
    for pkg in img1packages:
      print pkg
    print "Only in image2\n"
    for pkg in img2packages:
      print pkg
    print

if __name__ == "__main__":
  main()

Given the above python script to postprocess json output, you can produce the following behavior:

container-diff gcr.io/gcp-runtimes/multi-base gcr.io/gcp-runtimes/multi-modified -a -j | python pyscript.py

Only in image1

Only in image2

('libpython3.4-stdlib', 9484)
('python3.4-minimal', 4506)
('libpython3.4-minimal', 3310)
('python3.4', 336)
('dh-python', 277)
('libmpdec2', 275)
('python3-minimal', 96)
('python3', 36)
('libpython3-stdlib', 28)

Make your own differ

Feel free to develop your own analyzer leveraging the utils currently available. PRs are welcome!

Custom Analyzer Quickstart

In order to quickly make your own analyzer, follow these steps:

  1. Determine if you can use existing analyzing or diffing tools. If you can make use of existing tools, you then need to construct the structs to feed into the tools by getting all of the packages for each image or the analogous quality to be analyzed. To determine if you can leverage existing tools, think through these questions:
  • Are you trying to analyze packages?
    • Yes: Does the relevant package manager support different versions of the same package on one image?
    • No: Look to History and File System differs as models for diffing.
  1. Write your analyzer driver in the differs directory, such that you have a struct for your analyzer type and two methods for that analyzer: Analyze for single image analysis and Diff for comparison between two images:
type YourAnalyzer struct {}

func (a YourAnalyzer) Analyze(image util.Image) (util.Result, error) {...}
func (a YourAnalyzer) Diff(image1, image2 util.Image) (util.Result, error) {...}

The image arguments passed to your analyzer contain the path to the unpacked tar representation of the image, as well as certain configuration information (e.g. environment variables upon image creation and image history).

If using existing package tools, you should create the appropriate structs (e.g. SingleVersionPackageAnalyzeResult or SingleVersionPackageDiffResult) to analyze or diff. Otherwise, create your own structs which should yield information to fill an AnalyzeResult or DiffResult as the return type for Analyze() and Diff(), respectively, and should implement the Result interface, as in the next step.

  1. Create a struct following the Result interface by implementing the following two methods.
type Result interface {
	OutputStruct() interface{}
	OutputText(resultType string, format string) error
}

This is where you define how your analyzer should output for a human readable format (OutputText) and as a struct which can then be written to a .json file. See util/diff_output_utils.go and util/analyze_output_utils.go.

  1. Add your analyzer to the Analyzers map in differs/differs.go with the corresponding Analyzer struct as the value.

container-diff's People

Contributors

aaron-prindle avatar abbytiz avatar antechrestos avatar cben avatar cftorres avatar datwiz avatar davidcassany avatar deorbit avatar dependabot[bot] avatar dlorenc avatar donmccasland avatar ferhatelmas avatar intelzhongjie avatar loosebazooka avatar lvjp avatar mpv avatar nicolasdilley avatar nkubala avatar peter-evans avatar r2d4 avatar riverar avatar santiagotorres avatar sharifelgamal avatar surajssd avatar tequilarista avatar testwill avatar thehackercat avatar vrothberg avatar vsoch avatar yarikoptic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

container-diff's Issues

AptDiffer not working with a apt repo with a key

$ sudo ${HOME}/bin/container-diff gcr.io/google-appengine/php71:2017-08-22-15-24 gcr.io/google-appengine/php71
...
...
E0825 16:16:24.508140   16621 differs.go:41] Error getting diff with AptDiffer: stat php712017-08-22-15-24: required key not available
E0825 16:16:24.508224   16621 differs.go:41] Error getting diff with NodeDiffer: stat php712017-08-22-15-24: required key not available

The apt repo's key is installed within the container image.

"failed to untar layer with error ... too many open files"

Running the linux binary downloaded 2017-08-18 on a Goobuntu workstation shows no packages and incorrect diff.

$ md5sum /usr/local/bin/container-diff-amd64-linux
6b08c116217e7a7aee6c7a7306bf2d54 /usr/local/bin/container-diff-amd64-linux

$ sudo /usr/local/bin/container-diff-amd64-linux gcr.io/google-appengine/python:2017-07-25-110644 gcr.io/google-appengine/python:2017-08-18-131018 >stdout.txt 2>stderr.txt

stderr.txt
stdout.txt

Unable to read local Docker instance?

I ran the tool against my sample AppEngine Flex app image but got permission denied...

$ container-diff us.gcr.io/<project>/appengine/default.20170825t183334
E0825 23:08:13.553821   86961 image_prep_utils.go:121] denied: Permission denied for "latest" from request "/v2/<project>/appengine/default.20170825t183334/manifests/latest".
E0825 23:08:13.563247   86961 root.go:142] denied: Permission denied for "latest" from request "/v2/<project>/appengine/default.20170825t183334/manifests/latest".
E0825 23:08:13.563282   86961 root.go:73] Could not perform image analysis

** Note I replaced my project ID with .

I take it that the tool is not aware of any GCP service authentication. So, I decided to download the image via gcloud docker pull ...

$ gcloud docker -- pull us.gcr.io/<project>/appengine/default.20170825t183334:latest
latest: Pulling from <project>/appengine/default.20170825t183334
685c85508923: Pull complete
a2f1e8cf3cf3: Pull complete
524b56f5f096: Pull complete
Digest: sha256:497755d995423592adf8a3cf2fc01ef3eb6545a7b1a78e87430b7890dbb7ea84
Status: Downloaded newer image for us.gcr.io/<project>/appengine/default.20170825t183334:latest

$ docker images
REPOSITORY                                                  TAG                 IMAGE ID            CREATED             SIZE
us.gcr.io/<project>/appengine/default.20170825t183334   latest              2683605e0271        5 hours ago         27.3MB

I was hoping that given that the image is now on my local Docker instance that it will be able to read from it, but I think it's still reading off from GCR ...

$ container-diff us.gcr.io/<project>/appengine/default.20170825t183334:latest
E0825 23:11:04.949147   87302 image_prep_utils.go:121] denied: Permission denied for "latest" from request "/v2/<project>/appengine/default.20170825t183334/manifests/latest".
E0825 23:11:04.950083   87302 root.go:142] denied: Permission denied for "latest" from request "/v2/<project>/appengine/default.20170825t183334/manifests/latest".
E0825 23:11:04.950109   87302 root.go:73] Could not perform image analysis

I had to save it to a tar file and run the tool against it to make it work.

Empty types in diff command returns apt diff only

Command help shows that default is apt, but the ReadMe file states that default give diff of all types

`container-diff diff daemon://registry.access.redhat.com/rhel7:latest daemon://myimage:v1

-----Apt-----

Packages found only in registry.access.redhat.com/rhel7:latest: None

Packages found only in myimage:v1: None

Version differences: None`

pip differ doesn't respect all site-package directories

Currently the code just looks in /usr/local/lib/<python_version>/site-packages for package installations. Looking at the directories that python could possibly have packages installed in by default, I see:

➜  ~ docker run -it --entrypoint=/bin/bash gcr.io/google-appengine/python
root@7e6805303827:/home/vmagent/app# python -m site
sys.path = [
    '/home/vmagent/app',
    '/usr/lib/python2.7',
    '/usr/lib/python2.7/plat-x86_64-linux-gnu',
    '/usr/lib/python2.7/lib-tk',
    '/usr/lib/python2.7/lib-old',
    '/usr/lib/python2.7/lib-dynload',
    '/usr/local/lib/python2.7/dist-packages',
    '/usr/lib/python2.7/dist-packages',
]

These values get initialized by python at start time, and are hardcoded into the source. We should at least check the default paths when checking Python packages.

Add support for pip installed packages outside of normal site-package directory

by default, pip just puts all packages in site-packages. but you can configure it to install them anywhere, for example by passing --target=/some/random/directory to pip install and then adding that directory to your PYTHONPATH. it might be the case that we want to check all directories on the PYTHONPATH when we do the python diff.

Unable to perform diff on fedora host machine

I wanted to compare the exited container and the base image it is based off of but got following error:

$ sudo ~/.local/bin/container-diff diff 422dc563ca32 53fc993ed0ae
E1118 16:14:14.606483    4485 image_prep_utils.go:99] errors:
denied: requested access to the resource is denied
unauthorized: authentication required
E1118 16:14:14.771308    4485 image_prep_utils.go:99] errors:
denied: requested access to the resource is denied
unauthorized: authentication required
E1118 16:14:14.771363    4485 differs.go:62] Error getting diff with AptAnalyzer: stat : no such file or directory
E1118 16:14:14.771391    4485 diff.go:47] Could not retrieve diff: Could not perform diff on {  {{[]} []}} and {  {{[]} []}}

Steps to reproduce:

Create a container with some content

$ docker run -it fedora bash                                                                                                                      [12/12]
[root@53fc993ed0ae /]# cat > file
yeah yeah

^C
[root@53fc993ed0ae /]# exit

Get image ID:

$ docker images
REPOSITORY                   TAG                 IMAGE ID            CREATED             SIZE
fedora                       latest              422dc563ca32        3 days ago          252MB

Get the exited container ID:

$ docker ps -a
CONTAINER ID        IMAGE                COMMAND                  CREATED             STATUS                            PORTS               NAMES
53fc993ed0ae        fedora               "bash"                   19 seconds ago      Exited (130) 8 seconds ago                            keen_shannon
5bcb29c50c7c        fedora               "bash"                   2 minutes ago       Exited (127) About a minute ago                       ecstatic_lewin
...

Do the diff as shown in the top:

$ sudo ~/.local/bin/container-diff diff 422dc563ca32 53fc993ed0ae
E1118 16:14:14.606483    4485 image_prep_utils.go:99] errors:
denied: requested access to the resource is denied
unauthorized: authentication required
E1118 16:14:14.771308    4485 image_prep_utils.go:99] errors:
denied: requested access to the resource is denied
unauthorized: authentication required
E1118 16:14:14.771363    4485 differs.go:62] Error getting diff with AptAnalyzer: stat : no such file or directory
E1118 16:14:14.771391    4485 diff.go:47] Could not retrieve diff: Could not perform diff on {  {{[]} []}} and {  {{[]} []}}

OS information:

$ cat /etc/redhat-release 
Fedora release 25 (Twenty Five)

$ container-diff version
v0.5.0

# SELinux is enabled
$ getenforce 
Enforcing

Provide makefile to build tool

Originally submitted by @r2d4: "I would like to run $ make to build the idiff tool to a .gitignored directory. I think it could be simple for now, with just one target to build the idiff binary, and another one to install to $GOBIN. In the future, it might be cool to also support dockerized builds."

Remove /etc/docker/certs.d hack

We should verify that it works without this hack in the newly updated containers/image library.

There are two instances of it in this repo.

ctx := &types.SystemContext{
		DockerCertPath: tmpCerts,
	}

Error attempting to use container-diff w/ gcr.io. Permission denied for /etc/docker/certs.d/gcr.io

I have public images hosted @ gcr.io that I am attempting to diff. When trying to run container-diff, I get the following errors:

aprindle@aprindle:~/runtimes-common/src/github.com/GoogleCloudPlatform/container-diff$ ./container-diff gcr.io/k8s-minikube
/localkube-dind-image:v1.7.0 gcr.io/k8s-minikube/localkube-dind-image:v1.7.0-devshell
E0817 11:31:59.112045 98632 image_prep_utils.go:121] open /etc/docker/certs.d/gcr.io: permission denied
E0817 11:31:59.112369 98632 root.go:75] open /etc/docker/certs.d/gcr.io: permission denied

Running the command with sudo resolves the issue

Unable to read my project's GCR image paths

Related to issue #48 but for remote paths.

$ container-diff analyze us.gcr.io/<project>/appengine/default.20171006t183930:latest
E1010 10:01:15.568136   40141 image_prep_utils.go:99] denied: Permission denied for "latest" from request "/v2/<project>/appengine/default.20171006t183930/manifests/latest".
E1010 10:01:15.569398   40141 analyze.go:46] Error processing image: denied: Permission denied for "latest" from request "/v2/<project>/appengine/default.20171006t183930/manifests/latest".

I'm guessing this has to do with permissions on my project's GCR paths. There's doc on how to make the GCR path public -- https://cloud.google.com/container-registry/docs/access-control. Not easy to figure out the corresponding GS bucket path for it though.

Anyways, filing this feature request if somehow container-diff can be made to use my project's token authentication to analyze a remote image w/o changing ACLs.

Got permission denied with a normal user

$ container-diff gcr.io/google-appengine/php71:2017-08-22-15-24 gcr.io/google-appengine/php71
E0825 16:15:04.495977 16521 image_prep_utils.go:121] open /etc/docker/certs.d/gcr.io: permission denied
E0825 16:15:04.496338 16521 root.go:84] open /etc/docker/certs.d/gcr.io: permission denied

Not all packages in Godeps are in /vendor

Not all packages seem to be uploaded to /vendor. Currently a godep restore is required to build container-diff when checking out the repo. The package that was noted as being missing was:
github.com/sirupsen/logrus/

Mismatched dependencies when building for Windows

The crypto and sys dependencies from the golang repo are currently incompatible when building for Windows. We need to update these in the /vendor folder.

# github.com/GoogleCloudPlatform/container-diff/vendor/golang.org/x/crypto/ssh/terminal
vendor/golang.org/x/crypto/ssh/terminal/util_windows.go:42: undefined: windows.ENABLE_ECHO_INPUT
vendor/golang.org/x/crypto/ssh/terminal/util_windows.go:42: undefined: windows.ENABLE_PROCESSED_INPUT
vendor/golang.org/x/crypto/ssh/terminal/util_windows.go:42: undefined: windows.ENABLE_LINE_INPUT
vendor/golang.org/x/crypto/ssh/terminal/util_windows.go:42: undefined: windows.ENABLE_PROCESSED_OUTPUT
vendor/golang.org/x/crypto/ssh/terminal/util_windows.go:43: undefined: windows.SetConsoleMode
vendor/golang.org/x/crypto/ssh/terminal/util_windows.go:62: undefined: windows.SetConsoleMode
vendor/golang.org/x/crypto/ssh/terminal/util_windows.go:67: undefined: windows.ConsoleScreenBufferInfo
vendor/golang.org/x/crypto/ssh/terminal/util_windows.go:68: undefined: windows.GetConsoleScreenBufferInfo
vendor/golang.org/x/crypto/ssh/terminal/util_windows.go:91: undefined: windows.ENABLE_ECHO_INPUT
vendor/golang.org/x/crypto/ssh/terminal/util_windows.go:92: undefined: windows.ENABLE_PROCESSED_INPUT
vendor/golang.org/x/crypto/ssh/terminal/util_windows.go:92: too many errors
# github.com/GoogleCloudPlatform/container-diff/vendor/github.com/opencontainers/runc/libcontainer/user
vendor/github.com/opencontainers/runc/libcontainer/user/lookup.go:44: undefined: unix.Getuid
vendor/github.com/opencontainers/runc/libcontainer/user/lookup.go:92: undefined: unix.Getgid```

Add support for raw tars

Currently, the code converts docker images to tars using docker save, which is a docker specific format. We should generalize this to tarballs created in other formats, specifically through the bazel docker_flatten rule.

Build error on OSX

$ make cross
can't load package: ../go/src/github.com/GoogleCloudPlatform/container-diff/utils/image_prep_utils.go:15:2: case-insensitive import collision: "github.com/GoogleCloudPlatform/container-diff/vendor/github.com/Sirupsen/logrus" and "github.com/GoogleCloudPlatform/container-diff/vendor/github.com/sirupsen/logrus"
GOOS=linux GOARCH=amd64 go build -tags "container_image_ostree_stub containers_image_openpgp" -o out/container-diff-linux-amd64 github.com/GoogleCloudPlatform/container-diff
../go/src/github.com/GoogleCloudPlatform/container-diff/utils/image_prep_utils.go:15:2: case-insensitive import collision: "github.com/GoogleCloudPlatform/container-diff/vendor/github.com/Sirupsen/logrus" and "github.com/GoogleCloudPlatform/container-diff/vendor/github.com/sirupsen/logrus"
make: *** [out/container-diff-linux-amd64] Error 1

no filesystem diff found for different images

Readme says:

container-diff is a tool for analyzing and comparing container images. container-diff can examine images along several different criteria, including:

  • Docker Image History
  • Image file system
  • ...

But when I run:

 ./container-diff-darwin-amd64 diff daemon://golang:1.9-alpine daemon://golang:1.8-alpine

I actually don't get an "image filesystem diff"


-----Apt-----

Packages found only in golang:1.9-alpine: None

Packages found only in golang:1.8-alpine: None

Version differences: None

I actually expected to see something like git status diff output saying these are the files that are in image A, and not in B (or vice versa) and here are the files that are different between two images.

This tool does not seem to be doing this. So maybe the statement about "Image file system" diffing should be removed.

ImagePrepper should use ImageReference

I think the real problem here is that ImagePrepper shouldn't have Source be a string but it should actually be a containers/image types.ImageReference, which is exactly what you can pass into all of the containers/images functions without have to worry about parsing it at the end.

#97 (comment)

Errors - Can this be cycled outside of .go?

dk@dk-VirtualBox:~/Docker$ container-diff diff daemon://JustAlpine daemon://AlpineFipsBase
E1016 16:38:53.452142 3392 differs.go:62] Error getting diff with AptAnalyzer: stat : no such file or directory
E1016 16:38:53.452238 3392 diff.go:47] Could not retrieve diff: Could not perform diff on { {{[]} []}} and { {{[]} []}}

dk@dk-VirtualBox:~/Docker$

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.