Visualizing Docker data
Follow @dockviz for updates.
This command takes Docker image and container information and presents in different ways, to help you understand what's going on inside the system.
# 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"
dockviz images -t, which has similar output to docker images -t.apt-get update && apt-get install graphvizor
brew update && brew install graphvizCurrently, 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.pngImage 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.pngOr as a treemap:
$ dockviz images -d | patchwork -Tpng -o treemap.png
OR
$ dockviz images --dot | patchwork -Tpng -o treemap.pngOr in short form:
$ dockviz images -s
nate/mongodb: latest
redis: latest
ubuntu: 12.04, precise, 12.10, quantal, 13.04, raringOr as a tree in the terminal:
…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:raringShowing incremental size rather than cumulative:
…Showing non-human numbers, for precision:
…It is also possible to show the image's CreatedBy field, for help identifying image layers when they show up with "" image Ids.
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.
…Note: GNU netcat doesn't support -U (UNIX socket) flag, so OpenBSD variant can be used.
See the releases area for binaries.
# 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
No open issues yet, or sync has not completed.