Skip to content

Instantly share code, notes, and snippets.

@thecodingmonkey-zz
Created December 11, 2015 11:52
Show Gist options
  • Save thecodingmonkey-zz/5a3110e4345c383af724 to your computer and use it in GitHub Desktop.
Save thecodingmonkey-zz/5a3110e4345c383af724 to your computer and use it in GitHub Desktop.
List all docker containers + volume sizes
#!/bin/sh
for d in `docker ps -a | awk '{print $1}' | tail -n +2`; do
d_name=`docker inspect -f {{.Name}} $d`
echo "========================================================="
echo "$d_name ($d) container size:"
sudo du -d 2 -h /var/lib/docker/aufs | grep `docker inspect -f "{{.Id}}" $d`
echo "$d_name ($d) volumes:"
docker inspect -f "{{.Volumes}}" $d | sed 's/map\[//' | sed 's/]//' | tr ' ' '\n' | sed 's/.*://' | xargs sudo du -d 1 -h
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment