Skip to content

Instantly share code, notes, and snippets.

@rhodrid
Created August 29, 2018 07:49
Show Gist options
  • Save rhodrid/22f8713dbc6d7485398972baa09b96ea to your computer and use it in GitHub Desktop.
Save rhodrid/22f8713dbc6d7485398972baa09b96ea to your computer and use it in GitHub Desktop.
Remove all docker image versions
#!/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