aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtools/cleanup-containers8
-rwxr-xr-xtools/cleanup-images7
2 files changed, 12 insertions, 3 deletions
diff --git a/tools/cleanup-containers b/tools/cleanup-containers
index 7b0e8341e..b94c5db1e 100755
--- a/tools/cleanup-containers
+++ b/tools/cleanup-containers
@@ -1,3 +1,7 @@
#!/bin/bash
-
-docker rm $@ $(docker ps -a -q)
+CONTAINERS=`docker ps -a -q`
+if [[ -z "$CONTAINERS" ]]; then
+ echo "No containers to cleanup, exit now."
+ exit 0
+fi
+docker rm $@ $CONTAINERS
diff --git a/tools/cleanup-images b/tools/cleanup-images
index c0b1db55c..871afd1d1 100755
--- a/tools/cleanup-images
+++ b/tools/cleanup-images
@@ -6,4 +6,9 @@ cd "$(dirname "$REAL_PATH")/.."
. tools/validate-docker-execute
-docker rmi $@ $(docker images -a -q)
+IMAGES=`docker images -a -q`
+if [[ -z "$IMAGES" ]]; then
+ echo "No images to cleanup, exit now."
+ exit 0
+fi
+docker rmi $@ $IMAGES