diff --git a/doc/operating-kolla.rst b/doc/operating-kolla.rst index dde9178ffc..37ce96e2ba 100644 --- a/doc/operating-kolla.rst +++ b/doc/operating-kolla.rst @@ -32,5 +32,5 @@ triggered on the Docker host when the neutron-agents containers are launched. This can be useful when you want to do a new clean deployment, particularly one changing the network topology. -``tools/cleanup-images`` can be used to remove all Docker images from the -local Docker cache. Note: this will remove the registry also. +``tools/cleanup-images`` can be used to remove all Docker images built by +Kolla from the local Docker cache. diff --git a/tools/cleanup-images b/tools/cleanup-images index 0650052207..26073c5bf0 100755 --- a/tools/cleanup-images +++ b/tools/cleanup-images @@ -4,11 +4,13 @@ REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')") cd "$(dirname "$REAL_PATH")/.." -. tools/validate-docker-execute.sh +. tools/validate-docker-execute -IMAGES=`docker images -a -q` -if [[ -z "$IMAGES" ]]; then +KOLLA_IMAGES=$(docker images -a --filter "label=kolla_version" --format "{{.ID}}") + +if [[ -z "$KOLLA_IMAGES" ]]; then echo "No images to cleanup, exit now." exit 0 fi -docker rmi $@ $IMAGES + +docker rmi $@ $KOLLA_IMAGES