Created
August 29, 2018 07:49
-
-
Save rhodrid/22f8713dbc6d7485398972baa09b96ea to your computer and use it in GitHub Desktop.
Remove all docker image versions
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
#!/usr/bin/env bash | |
IMAGE=$1 | |
: ${IMAGE:?"Missing image. Syntax: bulk_image_delete.sh <image>"} | |
docker images $IMAGE | tail -n +2 | awk '{ print $1 ":" $2}' | |
echo "Do you want to continue?" | |
select yn in "yes" "no"; do | |
case $yn in | |
yes ) docker images $IMAGE | tail -n +2 | awk '{ print $1 ":" $2}' | xargs docker rmi; break;; | |
no ) exit;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment