Skip to content

Instantly share code, notes, and snippets.

@rpherrera
Created January 15, 2015 19:12
Show Gist options
  • Save rpherrera/f326f376411d9ca9788c to your computer and use it in GitHub Desktop.
Save rpherrera/f326f376411d9ca9788c to your computer and use it in GitHub Desktop.
docker dockviz view containers images gnome
#!/bin/bash
# Install dockviz:
# https://github.com/justone/dockviz
# You can import it from .bashrc with the following commands (assuming you saved this script in '~/bin':
# echo ". ~/bin/dockviz-containers-images.sh" >>~/.bashrc
# source ~/.bashrc
function dockviz_containers() {
timestamp=`date +%s`
mkdir -p ~/tmp
echo -e "GET /containers/json?all=1 HTTP/1.0\r\n" | nc -U /var/run/docker.sock | tail -n +5 | dockviz containers --dot | dot -Tpng -o ~/tmp/containers-${timestamp}.png && gnome-open ~/tmp/containers-${timestamp}.png
}
function dockviz_images() {
timestamp=`date +%s`
mkdir -p ~/tmp
echo -e "GET /images/json?all=1 HTTP/1.0\r\n" | nc -U /var/run/docker.sock | tail -n +5 | dockviz images --dot | dot -Tpng -o ~/tmp/images-${timestamp}.png && gnome-open ~/tmp/images-${timestamp}.png
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment