Created
October 8, 2016 08:48
-
-
Save ronanguilloux/90d37a820c15fc58168058efaf79980f to your computer and use it in GitHub Desktop.
Docker images disk usage calculation
This file contains 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/bash | |
# disk-usage from docker-experiments | |
# https://github.com/rsp/docker-experiments | |
# by Rafał Pocztarski - https://github.com/rsp | |
if [ $# -ne 1 ]; then | |
echo "Usage: $0 \"image1 image2 ...\"" | |
exit 1 | |
fi | |
images="$1" | |
echo "docker-experiments/disk-usage - data from `date -I`" | |
echo "See: https://github.com/rsp/docker-experiments" | |
echo -e "Image\tDisk usage" | |
echo -e "-----\t----------" | |
for image in $images; do | |
echo -ne "$image\t" | |
docker run --entrypoint=/bin/sh $image -c \ | |
'du -sh / 2>/dev/null | cut -f1' \ | |
|| echo "ERROR!" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment