Created
March 28, 2018 01:48
-
-
Save dmitry-salnikov/4ed17130e70a1bb6b32e962435c2ba5c to your computer and use it in GitHub Desktop.
Get the size of docker container
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/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