95607f162d
Allow remove custom images with a regex Change-Id: I7f8bbd59509f543150e58165575ad7b530dc38ba
21 lines
562 B
Bash
Executable File
21 lines
562 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Move to top level directory
|
|
REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')")
|
|
cd "$(dirname "$REAL_PATH")/.."
|
|
|
|
. tools/validate-docker-execute.sh
|
|
|
|
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
|