Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save shaposhnikoff/d5719328c5a29d809d510bc8bea609da to your computer and use it in GitHub Desktop.

Select an option

Save shaposhnikoff/d5719328c5a29d809d510bc8bea609da 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