Last active
August 29, 2015 14:16
-
-
Save linki/196ac6bf32e7c4f4652b to your computer and use it in GitHub Desktop.
remove superflous images
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
#!/usr/bin/env bash | |
images=( $(docker images | awk '{ print $1 }' | sort | uniq -c | awk '{print $2}' ) ) | |
for i in "${images[@]}" | |
do | |
echo "removing superflous images for" $i | |
docker images | grep "$i" | tail -n +2 | grep -v latest | awk '{print $1 ":" $2}' | xargs docker rmi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
make sure to remove containers before