From 902456406640975b63685e3abc99ec95de336c17 Mon Sep 17 00:00:00 2001 From: Mauricio Lima Date: Thu, 5 May 2016 11:43:32 -0400 Subject: [PATCH] Deleting only images from kolla build Co-Authored-By: Carlos Cesario Change-Id: I3e9652e1cac156f822b388d2b9fd910180b4a892 Closes-Bug: #1551933 --- doc/operating-kolla.rst | 4 ++-- tools/cleanup-images | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) 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