Remove custom images

Allow remove custom images with a regex

Change-Id: I7f8bbd59509f543150e58165575ad7b530dc38ba
This commit is contained in:
Eduardo Gonzalez 2017-01-16 16:47:49 +00:00
parent a3078d50e1
commit 95607f162d

View File

@ -6,11 +6,15 @@ cd "$(dirname "$REAL_PATH")/.."
. tools/validate-docker-execute.sh
KOLLA_IMAGES=$(docker images -a --filter "label=kolla_version" --format "{{.ID}}")
if [ -n "$1" ]; then
KOLLA_IMAGES=$(docker images -a --filter "label=kolla_version" --format "{{.Repository}}\t{{.ID}}" | grep -E "$1" | awk '{print$2}')
else
KOLLA_IMAGES=$(docker images -a --filter "label=kolla_version" --format "{{.ID}}")
fi
if [[ -z "$KOLLA_IMAGES" ]]; then
echo "No images to cleanup, exit now."
exit 0
else
docker rmi -f $KOLLA_IMAGES
fi
docker rmi -f $@ $KOLLA_IMAGES