Code Monkey home page Code Monkey logo

dockviz's Introduction

Follow @dockviz for updates.

dockviz: Visualizing Docker Data

This command takes Docker image and container information and presents in different ways, to help you understand what's going on inside the system.

Quick Start

  1. Install dockviz. Either:
  • Download the latest release.
  • Set up an alias to run it from the (5.8 MB) docker image:
# if docker client using local unix socket
alias dockviz="docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock nate/dockviz"

# if docker client using tcp
alias dockviz="docker run -it --rm -e DOCKER_HOST='tcp://127.0.0.1:2375' nate/dockviz"

  1. Visualize images by running dockviz images -t, which has similar output to docker images -t.
  • Image can be visualized as Graphviz, or as a tree or short summary in the terminal. Only Graphviz output has been implemented for containers.
  • If you would like to visualize outside the container you will have to install Graphviz first.
apt-get update && apt-get install graphviz

or

brew update && brew install graphviz

Output Examples

Containers

Currently, containers are visualized with labelled lines for links. Containers that aren't running are greyed out.

# show all containers
$ dockviz containers -d | dot -Tpng -o containers.png

# only show running containers
$ dockviz containers -d -r | dot -Tpng -o containers.png

Images

Image info is visualized with lines indicating parent images:

$ dockviz images -d | dot -Tpng -o images.png

$ dockviz images -d -l | dot -Tpng -o images.png
OR
$ dockviz images --dot --only-labelled | dot -Tpng -o images.png

Or as a treemap:

$ dockviz images -d | patchwork -Tpng -o treemap.png
OR
$ dockviz images --dot | patchwork -Tpng -o treemap.png

Or in short form:

$ dockviz images -s
nate/mongodb: latest
redis: latest
ubuntu: 12.04, precise, 12.10, quantal, 13.04, raring

Or as a tree in the terminal:

$ dockviz images -t
└─511136ea3c5a Virtual Size: 0.0 B
  ├─f10ebce2c0e1 Virtual Size: 103.7 MB
  │ └─82cdea7ab5b5 Virtual Size: 103.9 MB
  │   └─5dbd9cb5a02f Virtual Size: 103.9 MB
  │     └─74fe38d11401 Virtual Size: 209.6 MB Tags: ubuntu:12.04, ubuntu:precise
  ├─ef519c9ee91a Virtual Size: 100.9 MB
  │ └─07302703becc Virtual Size: 101.2 MB
  │   └─cf8dc907452c Virtual Size: 101.2 MB
  │     └─a7cf8ae4e998 Virtual Size: 171.3 MB Tags: ubuntu:12.10, ubuntu:quantal
  │       │─e18d8001204e Virtual Size: 171.3 MB
  │       │ └─d0525208a46c Virtual Size: 171.3 MB
  │       │   └─59dac4bae93b Virtual Size: 242.5 MB
  │       │     └─89541b3b35f2 Virtual Size: 511.8 MB
  │       │       └─7dac4e98548e Virtual Size: 511.8 MB
  │       │         └─341d0cc3fac8 Virtual Size: 511.8 MB
  │       │           └─2f96171d2098 Virtual Size: 511.8 MB
  │       │             └─67b8b7262a67 Virtual Size: 513.7 MB
  │       │               └─0fe9a2bc50fe Virtual Size: 513.7 MB
  │       │                 └─8c32832f07ba Virtual Size: 513.7 MB
  │       │                   └─cc4e1358bc80 Virtual Size: 513.7 MB
  │       │                     └─5c0d04fba9df Virtual Size: 513.7 MB Tags: nate/mongodb:latest
  │       └─398d592f2009 Virtual Size: 242.2 MB
  │         └─0cd8e7f50270 Virtual Size: 243.6 MB
  │           └─594b6f8e6f92 Virtual Size: 243.6 MB
  │             └─f832a63e87a4 Virtual Size: 243.6 MB Tags: redis:latest
  └─02dae1c13f51 Virtual Size: 98.3 MB
    └─e7206bfc66aa Virtual Size: 98.5 MB
      └─cb12405ee8fa Virtual Size: 98.5 MB
        └─316b678ddf48 Virtual Size: 169.4 MB Tags: ubuntu:13.04, ubuntu:raring

Only showing labelled images:

$ dockviz images -t -l
└─511136ea3c5a Virtual Size: 0.0 B
  ├─f10ebce2c0e1 Virtual Size: 103.7 MB
  │ └─74fe38d11401 Virtual Size: 209.6 MB Tags: ubuntu:12.04, ubuntu:precise
  ├─ef519c9ee91a Virtual Size: 100.9 MB
  │ └─a7cf8ae4e998 Virtual Size: 171.3 MB Tags: ubuntu:12.10, ubuntu:quantal
  │   ├─5c0d04fba9df Virtual Size: 513.7 MB Tags: nate/mongodb:latest
  │   └─f832a63e87a4 Virtual Size: 243.6 MB Tags: redis:latest
  └─02dae1c13f51 Virtual Size: 98.3 MB
    └─316b678ddf48 Virtual Size: 169.4 MB Tags: ubuntu:13.04, ubuntu:raring

Showing incremental size rather than cumulative:

$ dockviz images -t -i
└─511136ea3c5a Virtual Size: 0.0 B
  ├─f10ebce2c0e1 Virtual Size: 103.7 MB
  │ └─82cdea7ab5b5 Virtual Size: 255.5 KB
  │   └─5dbd9cb5a02f Virtual Size: 1.9 KB
  │     └─74fe38d11401 Virtual Size: 105.7 MB Tags: ubuntu:12.04, ubuntu:precise
  ├─ef519c9ee91a Virtual Size: 100.9 MB
  │ └─07302703becc Virtual Size: 251.0 KB
  │   └─cf8dc907452c Virtual Size: 1.9 KB
  │     └─a7cf8ae4e998 Virtual Size: 70.1 MB Tags: ubuntu:12.10, ubuntu:quantal
  │       ├─e18d8001204e Virtual Size: 29.4 KB
  │       │ └─d0525208a46c Virtual Size: 71.0 B
  │       │   └─59dac4bae93b Virtual Size: 71.2 MB
  │       │     └─89541b3b35f2 Virtual Size: 269.3 MB
  │       │       └─7dac4e98548e Virtual Size: 0.0 B
  │       │         └─341d0cc3fac8 Virtual Size: 0.0 B
  │       │           └─2f96171d2098 Virtual Size: 0.0 B
  │       │             └─67b8b7262a67 Virtual Size: 1.9 MB
  │       │               └─0fe9a2bc50fe Virtual Size: 656.0 B
  │       │                 └─8c32832f07ba Virtual Size: 383.0 B
  │       │                   └─cc4e1358bc80 Virtual Size: 0.0 B
  │       │                     └─5c0d04fba9df Virtual Size: 0.0 B Tags: nate/mongodb:latest
  │       └─398d592f2009 Virtual Size: 70.9 MB
  │         └─0cd8e7f50270 Virtual Size: 1.4 MB
  │           └─594b6f8e6f92 Virtual Size: 0.0 B
  │             └─f832a63e87a4 Virtual Size: 0.0 B Tags: redis:latest
  └─02dae1c13f51 Virtual Size: 98.3 MB
    └─e7206bfc66aa Virtual Size: 190.0 KB
      └─cb12405ee8fa Virtual Size: 1.9 KB
        └─316b678ddf48 Virtual Size: 70.8 MB Tags: ubuntu:13.04, ubuntu:raring

Showing non-human numbers, for precision:

$ dockviz images -t -i -c
└─511136ea3c5a Size: 0
  ├─f10ebce2c0e1 Size: 103675325
  │ └─82cdea7ab5b5 Size: 255455
  │   └─5dbd9cb5a02f Size: 1919
  │     └─74fe38d11401 Size: 105667193 Tags: ubuntu:12.04, ubuntu:precise
  ├─ef519c9ee91a Size: 100930679
  │ └─07302703becc Size: 250998
  │   └─cf8dc907452c Size: 1919
  │     └─a7cf8ae4e998 Size: 70094270 Tags: ubuntu:12.10, ubuntu:quantal
  │       ├─e18d8001204e Size: 29352
  │       │ └─d0525208a46c Size: 71
  │       │   └─59dac4bae93b Size: 71150930
  │       │     └─89541b3b35f2 Size: 269335966
  │       │       └─7dac4e98548e Size: 0
  │       │         └─341d0cc3fac8 Size: 0
  │       │           └─2f96171d2098 Size: 0
  │       │             └─67b8b7262a67 Size: 1866379
  │       │               └─0fe9a2bc50fe Size: 656
  │       │                 └─8c32832f07ba Size: 383
  │       │                   └─cc4e1358bc80 Size: 0
  │       │                     └─5c0d04fba9df Size: 0 Tags: nate/mongodb:latest
  │       └─398d592f2009 Size: 70917743
  │         └─0cd8e7f50270 Size: 1418392
  │           └─594b6f8e6f92 Size: 0
  │             └─f832a63e87a4 Size: 0 Tags: redis:latest
  └─02dae1c13f51 Size: 98348330
    └─e7206bfc66aa Size: 190007
      └─cb12405ee8fa Size: 1903
        └─316b678ddf48 Size: 70822908 Tags: ubuntu:13.04, ubuntu:raring

It is also possible to show the image's CreatedBy field, for help identifying image layers when they show up with "" image Ids.

Running

Dockviz supports connecting to the Docker daemon directly. It defaults to unix:///var/run/docker.sock, but respects the following as well:

  • The DOCKER_HOST, DOCKER_CERT_PATH, and DOCKER_TLS_VERIFY environment variables, as set up by boot2docker or docker-machine.

  • Command line arguments (e.g. --tlscacert), like those that Docker itself supports.

Dockviz also supports receiving Docker image or container json data on standard input.

$ curl -s http://localhost:4243/images/json?all=1 | dockviz --stdin images --tree
$ curl -s http://localhost:4243/containers/json?all=1 | dockviz --stdin containers --dot | dot -Tpng -o containers.png
$ echo -e "GET /images/json?all=1 HTTP/1.0\r\n" | nc -U /var/run/docker.sock | sed '1,/^[[:space:]]*$/d' | dockviz --stdin images --tree
$ echo -e "GET /containers/json?all=1 HTTP/1.0\r\n" | nc -U /var/run/docker.sock | sed '1,/^[[:space:]]*$/d' | dockviz --stdin containers --dot | dot -Tpng -o containers.png
$ echo -e "GET /images/json?all=1 HTTP/1.0\r\n" | nc -U /var/run/docker.sock | sed '1,/^[[:space:]]*$/d' | docker run -i nate/dockviz --stdin images --tree
$ echo -e "GET /containers/json?all=1 HTTP/1.0\r\n" | nc -U /var/run/docker.sock | sed '1,/^[[:space:]]*$/d' | docker run -i nate/dockviz --stdin containers --dot | dot -Tpng -o containers.png

Note: GNU netcat doesn't support -U (UNIX socket) flag, so OpenBSD variant can be used.

Binaries

See the releases area for binaries.

Build

# install graphviz in host environment for rendering (Debian example)
sudo apt-get install git graphviz -y

# pull latest code
mkdir -p $GOPATH/src/github.com/nate/ && cd $GOPATH/src/github.com/nate/
git clone https://github.com/nate/dockviz.git && cd dockviz

# force static compilation for go language
export CGO_ENABLED=0

# fetch vendored dependencies
govendor sync

# build
go build

# build docker image
docker build --no-cache=true -t "nate/dockviz:1.0" -t "nate/dockviz:latest" .

# push to docker hub
docker login --username=mygituser --password=xxxxxxx
docker push nate/dockviz

dockviz's People

Contributors

afbjorklund avatar cswarth avatar fabianlee avatar gbin avatar gkovacs81 avatar grossws avatar justone avatar nicksarafa avatar remram44 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

dockviz's Issues

Image IDs differ when using --tree vs --dot

When running using --tree the ID is "missing" for images without a hash, and "sha1:hash" for images with a hash. When running using --dot all images contain the "synth:fake" value.

I think it would be best if both --tree and --dot produced the same output. Moreover, this output should match the output from docker images when possible. In other words, whenever a hash is available, it should be without a prefix and it should use the first 12 characters of the sha hash (unless the -n option is used). When a hash is not available, both should provide the same (either "missing", or better yet, the "synth:fake" value).

See parental hierarchy from an image

Assuming I have 2 images, base and compound, where compound is built upon base. If I run dockviz against base, I see the diagram down to compound. However, if I run dockviz against compound, the only item that appears is compound. Is there a way to force an upward tree from an image, to see its hierarchy?

Here is the current output of showing from base down, and then the output from compound3 (which doesn't show its parent hierarchy)

[jenkins@dev-ral0098 ~]$ dockviz images -l -d myorg/base:1.0.0-SNAPSHOT
digraph docker {
base -> "synth:288a4d" [style=invis]
"synth:288a4d" [label="133a02990407\nmyorg/base:1.0.0-SNAPSHOT",shape=box,fillcolor="paleturquoise",style="filled,rounded"];
"synth:288a4d" -> "synth:35a644"
"synth:35a644" [label="bc55eaecb80d\nmyorg/compound1:1.0.0-SNAPSHOT\nmyorg/compound1:latest",shape=box,fillcolor="paleturquoise",style="filled,rounded"];
"synth:288a4d" -> "synth:e3dbd2"
"synth:e3dbd2" [label="f2ceff0af63e\nmyorg/compound2:1.0.0-SNAPSHOT\nmyorg/compound2:latest",shape=box,fillcolor="paleturquoise",style="filled,rounded"];
"synth:288a4d" -> "synth:70f2b6"
"synth:70f2b6" [label="3980b2ad1f67\nmyorg/compound3:1.0.0-SNAPSHOT\nmyorg/compound3:latest",shape=box,fillcolor="paleturquoise",style="filled,rounded"];
base [style=invisible]
}
[jenkins@dev-ral0098 ~]$ dockviz images -l -d myorg/compound3
digraph docker {
base -> "synth:70f2b6" [style=invis]
"synth:70f2b6" [label="3980b2ad1f67\nmyorg/compound3:1.0.0-SNAPSHOT\nmyorg/compound3:latest",shape=box,fillcolor="paleturquoise",style="filled,rounded"];
base [style=invisible]

I hope this makes sense.

Thank you!

no container hierarchy

Image stuff does exactly what I wanted. I did not need container visualisation, but I tried it anyway. However it did not work.

output of type dockviz

dockviz is aliased to 'sudo --group docker docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock nate/dockviz'

Version: dockviz v0.5.0

Output from dockviz containers --dot

digraph docker {
 "condescending_jang" [label="condescending_jang\nc92e9cbe8955",shape=box,fillcolor="paleturquoise",style="filled,rounded"];
 "my3" [label="my3\n226d599edb13",shape=box,fillcolor="paleturquoise",style="filled,rounded"];
 "my2" [label="my2\n9e351c935ef7",shape=box,fillcolor="paleturquoise",style="filled,rounded"];
 "my1" [label="my1\n6cedc6ca3962",shape=box,fillcolor="paleturquoise",style="filled,rounded"];
}

Output of sudo --group docker docker ps -a

CONTAINER ID        IMAGE               COMMAND                CREATED              STATUS              PORTS               NAMES
226d599edb13        my-nginx:latest     "nginx -g 'daemon of   About a minute ago                                           my3    
9e351c935ef7        my-nginx:latest     "nginx -g 'daemon of   19 minutes ago                                               my2    
6cedc6ca3962        my-nginx:latest     "nginx -g 'daemon of   19 minutes ago       Up 19 minutes       80/tcp, 443/tcp     my1 

As you can see it is not graying out non-running containers, and not linking them to images.

Thanks,
Richard.

Error reading JSON on Docker 1.12.0-rc2

This is the error I get:

> docker run --privileged --rm --volume /var/run/docker.sock:/var/run/docker.sock nate/dockviz images -t
Unable to find image 'nate/dockviz:latest' locally
latest: Pulling from nate/dockviz
859806199386: Pull complete 
Digest: sha256:cb94a258654b47229e1945cc4c96ffe2648f04987dac66fbf1591a970dce41e6
Status: Downloaded newer image for nate/dockviz:latest
Error reading JSON: %!(EXTRA *json.SyntaxError=unexpected end of JSON input)

Docker info:

> docker info                                                                                                                                                [1]
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 1
Server Version: 1.12.0-rc2
Storage Driver: devicemapper
 Pool Name: docker-253:0-202156876-pool
 Pool Blocksize: 65.54 kB
 Base Device Size: 10.74 GB
 Backing Filesystem: xfs
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 20.25 MB
 Data Space Total: 107.4 GB
 Data Space Available: 52.14 GB
 Metadata Space Used: 593.9 kB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.147 GB
 Thin Pool Minimum Free Space: 10.74 GB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 WARNING: Usage of loopback devices is strongly discouraged for production use. Either use `--storage-opt dm.thinpooldev` or use `--storage-opt dm.no_warn_on_loop_devices=true` to suppress this warning.
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.107-RHEL7 (2016-06-09)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: host bridge overlay null
Swarm: inactive
Runtimes: default
Default Runtime: default
Security Options: seccomp
Kernel Version: 3.10.0-327.22.2.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 23.37 GiB
Name: blu-03
ID: CBXH:UD64:UUH7:DK4P:D2AC:Y627:3EGT:OTYB:YQTC:QH5C:TZKV:Q7X7
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
Insecure Registries:
 127.0.0.0/8

Show how to use dockviz with socket

This incantation worked for me:

echo -e "GET /images/json?all=1 HTTP/1.0\r\n" | nc -U /var/run/docker.sock | tail -n +5 | /tmp/dockviz images --tree

Layer id is <missing>

Thanks for this great project.

Since docker 1.1.0, docker image and layer are different things. Each image has an ID while layer only has hash checksum. Therefore, I find that layer id is when use dockviz

dockviz images -t
└─<missing> Virtual Size: 6.1 MB
  └─<missing> Virtual Size: 6.1 MB
    └─sha256:3ee5f Virtual Size: 6.1 MB Tags: nate/dockviz:latest
dockviz images -d | dot -Tpng -o images.png

images

It looks better if we can replace missing with the hash checksum of each layer....

How to install the plugin.

Sorry if my question is too dump but how could I install this plugin? I 've downloaded the release file but then what?
I have Ubuntu.

Thanks.

Support for local/remote registry

Is it possible to create a graph for all images in a local or remote docker registry? I have a large private registry, and pulling all images on a machine just to run dockviz once is outlandish.

Show incremental file size increases with images -t

I'm more interested in seeing how much new stuff is added in each layer then the total size of the current layer with the previous ones. Could there be an option for this in the images command? What do you think?

dockviz panic when supplying image name to --tree

Just fooling around with dockviz and ran across a crash. Don't know jack about Go yet or I'd try to come up with a pull request.

$ ./dockviz images --short
hello-world: latest
jupyter/notebook: latest
ipython/scipystack: latest

$ ./dockviz images --tree hello-world                                                                                                                                                               
panic: runtime error: slice bounds out of range

goroutine 1 [running]:
main.PrintTreeNode(0xc208010310, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /Users/cswarth/Development/dockviz/images.go:171 +0x504
main.WalkTree(0xc208010310, 0xc2080bda00, 0xc2080bda10, 0x1, 0x1, 0xc20803d9b0, 0x0, 0x0)
        /Users/cswarth/Development/dockviz/images.go:158 +0x519
main.jsonToTree(0xc2080bdb70, 0x7fff5fbffaf0, 0xb, 0x0, 0x0, 0x0)
        /Users/cswarth/Development/dockviz/images.go:132 +0x4e2
main.(*ImagesCommand).Execute(0x5c0b6c, 0xc20803d110, 0x1, 0x3, 0x0, 0x0)
        /Users/cswarth/Development/dockviz/images.go:90 +0x470
github.com/jessevdk/go-flags.(*Parser).ParseArgs(0xc20802e2d0, 0xc20800a010, 0x3, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0)
        /Users/cswarth/Development/dockviz/src/github.com/jessevdk/go-flags/parser.go:278 +0x8c1
github.com/jessevdk/go-flags.(*Parser).Parse(0xc20802e2d0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /Users/cswarth/Development/dockviz/src/github.com/jessevdk/go-flags/parser.go:154 +0xb1
main.main()
        /Users/cswarth/Development/dockviz/cli.go:29 +0x4b

goroutine 7 [runnable]:
net/http.(*persistConn).readLoop(0xc20808e2c0)
        /usr/local/Cellar/go/1.4.2/libexec/src/net/http/transport.go:928 +0x9ce
created by net/http.(*Transport).dialConn
        /usr/local/Cellar/go/1.4.2/libexec/src/net/http/transport.go:660 +0xc9f

goroutine 8 [select]:
net/http.(*persistConn).writeLoop(0xc20808e2c0)
        /usr/local/Cellar/go/1.4.2/libexec/src/net/http/transport.go:945 +0x41d
created by net/http.(*Transport).dialConn
        /usr/local/Cellar/go/1.4.2/libexec/src/net/http/transport.go:661 +0xcbc

Compiled dockviz from source using go1.4.2 on MacOS 10.10.4 (Yosemite)

$ docker version
Client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d
OS/Arch (client): darwin/amd64
Server version: 1.7.1
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 786b29d
OS/Arch (server): linux/amd64

improve the help in cli to indicate pass the /var/run/docker.sock

I already pull the nate/dockviz, and am used to forget the complete command to run it like

docker run --rm -v /var/run/docker.sock:/var/run/docker.sock nate/dockviz images -t

Will be nice to give hints or help when I just type

docker run nate/dockviz
docker run nate/dockviz image

Like the output

docker@boot2docker:~$ docker run --rm nate/dockviz images
dial unix /var/run/docker.sock: no such file or directory
you may want to try docker run --rm -v /var/run/docker.sock:/var/run/docker.sock nate/dockviz images -t

Or simple add help for this besides image and container

Then as end user, I don't need to google to have complete command line

Go vendoring?

Ref: Homebrew/homebrew-core#21801

@justone Would you be willing to start using a Go vendor directory or one of the other Go vendor systems so that we can avoid Go resource blocks in the Homebrew formula for dockviz?

Currently, the dockviz formula has four Go resource blocks. Checking whether there are updates for any, all, or none of these resources, and whether any new ones need to be added, every time dockviz is upgraded is not ideal, but In the absence of Go vendoring, this is the only way we can ensure reproducible builds.

Some good choices are
https://github.com/golang/dep (dep ensure)
https://github.com/Masterminds/glide (glide install)
https://github.com/kardianos/govendor (govendor sync)
https://github.com/tools/godep (godep restore)

Error reading JSON: %!(EXTRA *json.SyntaxError=unexpected end of JSON input)

It seems that I am the only user who has this problem: search for report of similar simpthom on internet was unsuccessful so far. Any idea how to get closer to the cause of the error?

docker info

Containers: 5
Running: 4
Paused: 0
Stopped: 1
Images: 29
Server Version: 1.11.2
Storage Driver: aufs
Root Dir: /data/docker/aufs
Backing Filesystem: extfs
Dirs: 125
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge null host
Kernel Version: 3.16.0-4-amd64
Operating System: Debian GNU/Linux 8 (jessie)
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 31.35 GiB
Name: XXX
ID: XXX
Docker Root Dir: /data/docker
Debug mode (client): false
Debug mode (server): false
Registry: https://index.docker.io/v1/
WARNING: No memory limit support
WARNING: No swap limit support
WARNING: No kernel memory limit support
WARNING: No oom kill disable support
WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support

Show tree only for a specific image

First, thanks - this is a really nice tool :)
Instead of showing the tree for all the images, I want to show the tree only for a specific image - is that something that is supported?

status of the project?

👋 is this project still maintained? Thanks!

If that is the case, I think we should consider moving to go modules build (govendor project is deprecated)

Feature request: Collapsed view

A useful feature would be to collapse long chains of dependent layers when there's no branching and none of the layers between two points in the graph are labelled. Perhaps the collapse could happen by default after a major release and then use a command line switch to optionally emit/expand on all of the details. In the mean time, the collapse feature could be optional.

E.g.,

From:

├─<missing> Virtual Size: 63.2 MB
│ └─<missing> Virtual Size: 64.2 MB
│   └─<missing> Virtual Size: 64.2 MB
│     └─<missing> Virtual Size: 64.2 MB
│       └─2eb2d388e1a2 Virtual Size: 64.2 MB Tags: ubuntu:18.04
│         └─4040366ea929 Virtual Size: 64.2 MB
│           └─c760175c924f Virtual Size: 1.3 GB
│             └─a05af0056379 Virtual Size: 1.3 GB
│               └─92307fb4f577 Virtual Size: 1.6 GB
│                 └─7ae420564a53 Virtual Size: 1.6 GB
│                   └─14e125e97949 Virtual Size: 1.8 GB
│                     └─e6a7a16eb779 Virtual Size: 1.8 GB
│                       └─7dc18daff83f Virtual Size: 1.8 GB
│                         └─88a0972c5601 Virtual Size: 2.0 GB
│                           └─6f210398b754 Virtual Size: 2.2 GB
│                             └─d36437dd6d91 Virtual Size: 2.2 GB
│                               └─371a47b727f3 Virtual Size: 2.2 GB
│                                 └─b5e85f78d8c6 Virtual Size: 2.2 GB
│                                   └─fd444c63c29c Virtual Size: 2.2 GB
│                                     └─88d6707832ef Virtual Size: 2.2 GB
│                                       └─630d9e8a61e9 Virtual Size: 2.2 GB
│                                         └─f4bc53a3b824 Virtual Size: 2.2 GB
│                                           └─164954efc6d6 Virtual Size: 2.2 GB
│                                             └─f5c46d8d5a7e Virtual Size: 2.2 GB
│                                               └─114b0d37c397 Virtual Size: 2.2 GB
│                                                 └─74e02d43d31d Virtual Size: 2.2 GB
│                                                   └─8b98b392a191 Virtual Size: 2.2 GB
│                                                     └─fae8b6ae4853 Virtual Size: 2.2 GB
│                                                       └─f506cd9335ce Virtual Size: 2.2 GB
│                                                         └─e53c60ef5f95 Virtual Size: 2.2 GB
│                                                           └─876a906daf9e Virtual Size: 2.2 GB
│                                                             └─b2adf33cd106 Virtual Size: 2.2 GB
│                                                               └─2a27335c7e7c Virtual Size: 2.2 GB
│                                                                 └─3c194ef79f0e Virtual Size: 2.6 GB
│                                                                   └─e9834370cd36 Virtual Size: 2.6 GB
│                                                                     └─1147fdd740ce Virtual Size: 2.6 GB
│                                                                       └─531613959f2a Virtual Size: 2.6 GB
│                                                                         └─6cd993018f28 Virtual Size: 2.7 GB
│                                                                           └─54d9b1f0a011 Virtual Size: 2.7 GB
│                                                                             └─052f131f4dad Virtual Size: 2.7 GB
│                                                                               └─6fb77c426cfc Virtual Size: 2.7 GB
│                                                                                 └─7da263073c3e Virtual Size: 2.8 GB
│                                                                                   └─b96344b7dcfe Virtual Size: 2.8 GB
│                                                                                     └─96e87d983215 Virtual Size: 3.1 GB
│                                                                                       └─f9148349994e Virtual Size: 3.1 GB
│                                                                                         └─5b38bb01d2d1 Virtual Size: 3.2 GB
│                                                                                           └─88740d7e7e51 Virtual Size: 3.2 GB
│                                                                                             └─378595f003a3 Virtual Size: 3.2 GB
│                                                                                               └─288da0906906 Virtual Size: 3.2 GB
│                                                                                                 └─4dca8def0f4b Virtual Size: 3.2 GB
│                                                                                                   └─dd8cf75c4153 Virtual Size: 3.4 GB
│                                                                                                     └─e9b5f794a766 Virtual Size: 3.4 GB
│                                                                                                       └─61f894fb3173 Virtual Size: 3.5 GB
│                                                                                                         └─311289a49e3b Virtual Size: 3.5 GB
│                                                                                                           └─0814f8196fce Virtual Size: 3.7 GB
│                                                                                                             └─735e577b1258 Virtual Size: 3.7 GB
│                                                                                                               └─1c336c47b793 Virtual Size: 3.8 GB
│                                                                                                                 └─7d735bd35dbb Virtual Size: 3.8 GB
│                                                                                                                   └─72dccdcca30d Virtual Size: 3.8 GB
│                                                                                                                     └─06c6087eb39b Virtual Size: 3.8 GB
│                                                                                                                       └─37cd60936b0b Virtual Size: 3.8 GB
│                                                                                                                         └─478ebbbc7ec0 Virtual Size: 4.1 GB
│                                                                                                                           └─553947870ce8 Virtual Size: 4.1 GB
│                                                                                                                             └─5db156b7a488 Virtual Size: 4.1 GB
│                                                                                                                               └─adcf84a26033 Virtual Size: 4.3 GB
│                                                                                                                                 └─08e99d787348 Virtual Size: 4.3 GB
│                                                                                                                                   └─21299bfffeb1 Virtual Size: 4.3 GB
│                                                                                                                                     └─2ffa0253caff Virtual Size: 4.3 GB
│                                                                                                                                       └─b2f084a571a9 Virtual Size: 4.7 GB
│                                                                                                                                         └─0cb9fe5a74ba Virtual Size: 5.0 GB
│                                                                                                                                           └─d94d94b54c47 Virtual Size: 5.0 GB
│                                                                                                                                             └─299cf350531f Virtual Size: 5.0 GB
│                                                                                                                                               └─7066d028cee4 Virtual Size: 5.0 GB
│                                                                                                                                                 └─0d6eb58e60e6 Virtual Size: 5.0 GB
│                                                                                                                                                   └─2a3d32ce4c0f Virtual Size: 5.0 GB
│                                                                                                                                                     └─9f0287a36ec3 Virtual Size: 5.0 GB
│                                                                                                                                                       └─c410ee887c83 Virtual Size: 5.3 GB
│                                                                                                                                                         └─e89edbe51bad Virtual Size: 6.8 GB
│                                                                                                                                                           └─424b48b6779e Virtual Size: 7.2 GB
│                                                                                                                                                             └─e902385474b6 Virtual Size: 8.2 GB
│                                                                                                                                                               └─24c80f04a599 Virtual Size: 8.2 GB
│                                                                                                                                                                 └─ca10c6824438 Virtual Size: 8.2 GB
│                                                                                                                                                                   └─fc4c29c1c846 Virtual Size: 8.2 GB
│                                                                                                                                                                     └─0b320e9b2dfd Virtual Size: 8.4 GB
│                                                                                                                                                                       └─02c6686eb22f Virtual Size: 8.4 GB
│                                                                                                                                                                         └─d4eb41435558 Virtual Size: 8.4 GB
│                                                                                                                                                                           └─d4b94a44d7d7 Virtual Size: 8.7 GB
│                                                                                                                                                                             └─c35528d57bcc Virtual Size: 8.8 GB
│                                                                                                                                                                               └─41207c4ba899 Virtual Size: 8.8 GB
│                                                                                                                                                                                 └─8a39531409fd Virtual Size: 8.8 GB
│                                                                                                                                                                                   └─0a17cd6f20c6 Virtual Size: 8.8 GB
│                                                                                                                                                                                     └─a8bed6a99ef6 Virtual Size: 8.8 GB
│                                                                                                                                                                                       └─78e50546055e Virtual Size: 8.8 GB
│                                                                                                                                                                                         └─c63a5b226ed9 Virtual Size: 8.8 GB
│                                                                                                                                                                                           └─efaecbeb1184 Virtual Size: 8.8 GB
│                                                                                                                                                                                             └─8ec1cc053c3f Virtual Size: 8.8 GB
│                                                                                                                                                                                               └─f9aef76f8f56 Virtual Size: 8.8 GB
│                                                                                                                                                                                                 └─b61fba4a3e71 Virtual Size: 8.8 GB Tags: aws/codebuild/standard:4.0

to

| ... 4 layer(s) collapsed
│   └─2eb2d388e1a2 Virtual Size: 64.2 MB Tags: ubuntu:18.04
        ... 92 layer(s) collapsed
│     └─b61fba4a3e71 Virtual Size: 8.8 GB Tags: aws/codebuild/standard:4.0

Add option for JSON output

The current code offers --dot format and --tree format output.
I think a more machine readable output as a JSON dictionary tree could be useful for automatic processing.

Doesn't work after upgrade to 1.11.0

After upgrading my docker-machine to version 1.11.0 dockviz returns error:
$ dockviz images -t
Error reading JSON: %!(EXTRA *json.SyntaxError=unexpected end of JSON input)

My system information:
$ docker info
Containers: 3
Running: 3
Paused: 0
Stopped: 0
Images: 58
Server Version: 1.11.0
Storage Driver: aufs
Root Dir: /mnt/sda1/var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 59
Dirperm1 Supported: true
Logging Driver: json-file
Plugins:
Volume: cifs local
Network: bridge null host
Kernel Version: 4.1.19-boot2docker
Operating System: Boot2Docker 1.11.0 (TCL 7.0); HEAD : 32ee7e9 - Wed Apr 13 20:06:49 UTC 2016
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 7.79 GiB
Name: default
ID: IP3A:ADCB:FJOB:CCLX:MOND:AZLI:O6B5:DVAN:BZJO:T4SL:RPC4:CTDT
Debug mode (server): true
File Descriptors: 31
Goroutines: 63
System Time: 2016-04-19T08:14:08.553994959Z
EventsListeners: 0
Init SHA1:
Init Path:
Docker Root Dir: /mnt/sda1/var/lib/docker
Labels:
provider=virtualbox

--privileged needed

I have to use --privileged to make dockviz run
docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock nate/dockviz containers
You might want to add that information to your documentation.

If I do not use --privileged I get the error:
Unable to access Docker socket, please run like this:
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock nate/dockviz containers
For more help, run 'dockviz help'

even though my user is part of the 'docker' group and /var/run/docker.sock is readable/writeable for docker group:
srw-rw----. 1 root docker 0 Feb 25 13:11 /var/run/docker.sock

The problem might be related to SELinux.

P.S: thanks for dockviz ... it is a great tool !!!!

FRQ: display the build command of each layer

hey, for now dockviz images -t just show the layer id and virtual size, i'd like to see the corresponding build command of that layer as well. (probably we can introduce a new flag for this).
thx

Error: stdin: syntax error in line 1 near 'Unable'

I'm getting the following error:

dockviz containers -d | dot -Tpng -o containers.png Unable to find image 'nate/dockviz:latest' locally latest: Pulling from nate/dockviz d6bcd48223ce: Pulling fs layer d6bcd48223ce: Verifying Checksum d6bcd48223ce: Download complete d6bcd48223ce: Pull complete Digest: sha256:0157f9ec324cc8970a7034712c6ccbcfda4778cb7d0c004bbe68e670fbe61b4d Status: Downloaded newer image for nate/dockviz:latest Error: <stdin>: syntax error in line 1 near 'Unable'

Any ideas what am I doing wrong? I believe I've just followed the instructions as explained here.

Support for network dependencies?

The current container dependency graph is not that helpful for containers that are indirectly dependent on each other through common networks.

For example, dockviz is completely missing the dependencies between the postgresql container and the jira container when running the container cluster of https://github.com/blacklabelops/jira.

$ docker network create jiranet
$ docker run --name postgres -d \
    --network jiranet \
    -v postgresvolume:/var/lib/postgresql \
    -e 'POSTGRES_USER=jira' \
    -e 'POSTGRES_PASSWORD=jellyfish' \
    -e 'POSTGRES_DB=jiradb' \
    -e 'POSTGRES_ENCODING=UNICODE' \
    -e 'POSTGRES_COLLATE=C' \
    -e 'POSTGRES_COLLATE_TYPE=C' \
    blacklabelops/postgres

Followed by:

$ docker run -d --name jira \
    --network jiranet \
    -v jiravolume:/var/atlassian/jira \
	  -e "JIRA_DATABASE_URL=postgresql://jira@postgres/jiradb" \
	  -e "JIRA_DB_PASSWORD=jellyfish"  \
	  -p 80:8080 blacklabelops/jira

If dockviz noted that both containers are connected to the same network, jiranet it would go a long way in visualizing that the containers are likely dependent on each other.

Feature request: Stacked blocks or force-directed graph viz

Thanks for dockviz!

I understand graphviz is doing most of the heavy lifting when it comes to visualization with this approach. Unfortunately, I don't think treemaps are the right approach for this use case. Usually, a treemap would be used for a bottom-up approach where we start with a given branch and want to know it's cumulative weight, including that of all the leaves 'owned' by the branch. E.g., all of the files nested under a given directory in a file system.

However, in the case of docker images, our interest is reversed. We'd prefer a top-down approach where we're interested in a particular peak in a mountain range and we want to determine the weight of all the supporting strata, including those which might also be undergirding other peaks. In the top-down analysis, a supporting stratum isn't necessarily 'owned' solely by a single peak.

In short, treemaps = sum(for all descendants of branch) analysis
...but for docker images we want: sum(for all ancestors of leaf) analysis

To that end, I think a better visualization would look more like a flamegraph or sunburst chart where we'd have more abstract/general/foundational building blocks across the bottom and more concrete/specific/dependent building blocks stacked up on top of their respective underlying dependencies. The area of any given block would be proportional to it's size in bytes.

Flame graphs: http://www.brendangregg.com/flamegraphs.html
Sunburst chart: https://architect-api.readthedocs.io/en/latest/text/document-vis-hierarchy.html#sunburst-chart

The main difference when compared to a regular flame graph is that the more dependent layers aren't necessarily constrained to be smaller than their dependencies. Some graphs might be top-heavy e.g., https://i.pinimg.com/736x/d3/79/61/d3796140d9104796457d8d26986c9f56.jpg

With Docker 1.10 dockviz don't see intermediate images

With Docker 1.10 dockviz don't see intermediate images. dockviz shows an explicitly pulled images only:

vektor@vektor-lx:/$ dockviz images -t
├─sha256:dd5cc Virtual Size: 652.9 MB Tags: maven:latest
├─sha256:2d310 Virtual Size: 539.7 MB Tags: openshift/origin:latest
├─sha256:97434 Virtual Size: 188.0 MB Tags: ubuntu:latest
├─sha256:a0d4a Virtual Size: 188.0 MB Tags: ubuntu:14.04
├─sha256:3668e Virtual Size: 5.9 MB Tags: nate/dockviz:latest
├─sha256:6fae6 Virtual Size: 348.8 MB Tags: training/webapp:latest
└─sha256:49d95 Virtual Size: 447.0 MB Tags: training/sinatra:latest
  └─sha256:957f5 Virtual Size: 452.5 MB Tags: vektor/sinatra:v2

Add option for numeric size

The current code defaults to human readable sizes.
I think a --numeric option would be useful for a more detailed analysis.

Unable to access Docker socket, please run like this

I got this after making an alias and running dockviz images -t

# dockviz images -t
Usage of loopback devices is strongly discouraged for production use. Either use `--storage-opt dm.thinpooldev` or use `--storage-opt dm.no_warn_on_loop_devices=true` to suppress this warning.
Unable to access Docker socket, please run like this:
  docker run --rm -v /var/run/docker.sock:/var/run/docker.sock nate/dockviz images <args>
For more help, run 'dockviz help'

'panic: runtime error: index out of range' using --stdin

dockviz v0.6.3

curl --unix-socket /var/run/docker.sock -k 'http://localhost/images/json?all=1' | docker run -i --rm nate/dockviz --stdin images -t
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  126k    0  126k    0     0   803k      0 --:--:-- --:--:-- --:--:--  798k
panic: runtime error: index out of range

goroutine 1 [running]:
main.PrintTreeNode(0xc4201f8620, 0xc4201ade50, 0x47, 0xc4201adea0, 0x47, 0x0, 0x0, 0x0, 0xcb45f50b, 0xcb45f50b, ...)
        /go/src/github.com/justone/dockviz/images.go:404 +0x592
main.jsonToText(0xc4201f8620, 0xc4201f45b0, 0x1, 0x1, 0xc420071e90, 0xc400000000, 0xc420012f20, 0x12)
        /go/src/github.com/justone/dockviz/images.go:370 +0x51d
main.jsonToText(0xc4201f8620, 0xc4201f4620, 0x1, 0x1, 0xc420071e90, 0xc400000000, 0xc4201d47f0, 0x10)
        /go/src/github.com/justone/dockviz/images.go:372 +0x650
main.jsonToText(0xc4201f8620, 0xc4201d88c0, 0x2, 0x2, 0xc420071e90, 0xc400000000, 0xc4201d47d0, 0xc)
        /go/src/github.com/justone/dockviz/images.go:365 +0x2f6
main.jsonToText(0xc4201f8620, 0xc4201f4770, 0x1, 0x1, 0xc420071e90, 0xc400000000, 0xc4201d47a0, 0xa)
        /go/src/github.com/justone/dockviz/images.go:372 +0x650
main.jsonToText(0xc4201f8620, 0xc4201d89a0, 0x2, 0x2, 0xc420071e90, 0xc400000000, 0xc4201d4770, 0x6)
        /go/src/github.com/justone/dockviz/images.go:365 +0x2f6
main.jsonToText(0xc4201f8620, 0xc4201d8a80, 0x2, 0x2, 0xc420071e90, 0x0, 0x830155, 0x4)
        /go/src/github.com/justone/dockviz/images.go:365 +0x2f6
main.jsonToText(0xc4201f8620, 0xc4201ea000, 0x36, 0x49, 0xc420071e90, 0xc400000000, 0x0, 0x0)
        /go/src/github.com/justone/dockviz/images.go:365 +0x2f6
main.jsonToTree(0xc4201ea000, 0x36, 0x49, 0xc420071e90, 0x0, 0xc4201e2000, 0x92)
        /go/src/github.com/justone/dockviz/images.go:283 +0xa2
main.(*ImagesCommand).Execute(0xa6ee70, 0xc420071bc0, 0x0, 0x3, 0xa6ee70, 0x1)
        /go/src/github.com/justone/dockviz/images.go:168 +0x491
github.com/justone/dockviz/vendor/github.com/jessevdk/go-flags.(*Parser).ParseArgs(0xc420145f10, 0xc42000e110, 0x3, 0x3, 0x0, 0xc420135f70, 0x4046a4, 0xc42006e058, 0x0)
        /go/src/github.com/justone/dockviz/vendor/github.com/jessevdk/go-flags/parser.go:320 +0x841
github.com/justone/dockviz/vendor/github.com/jessevdk/go-flags.(*Parser).Parse(0xc420145f10, 0x744d9c, 0x0, 0x0, 0x16, 0xc420145f10)
        /go/src/github.com/justone/dockviz/vendor/github.com/jessevdk/go-flags/parser.go:190 +0x71
main.main()
        /go/src/github.com/justone/dockviz/cli.go:30 +0x45

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.