Created
December 11, 2015 11:52
-
-
Save thecodingmonkey-zz/5a3110e4345c383af724 to your computer and use it in GitHub Desktop.
List all docker containers + volume sizes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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