diff options
author | 2017-02-13 09:16:29 +0000 | |
---|---|---|
committer | 2017-02-13 09:16:29 +0000 | |
commit | 9eae169018b1a04a50fc09e1d47e750876687cf6 (patch) | |
tree | be59771b9d008aa097fe11074a93510f83dcd570 | |
parent | 79b920c07b40d64e70f93f28a0822ad1488f32ee (diff) | |
parent | 81a982aa1dec85f0cb7ba8890de4df4c3043e1b1 (diff) |
Merge "No action when no container is there"
-rwxr-xr-x | jjb/functest/functest-cleanup.sh | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/jjb/functest/functest-cleanup.sh b/jjb/functest/functest-cleanup.sh index 3ef9b90dd..fc277b9ed 100755 --- a/jjb/functest/functest-cleanup.sh +++ b/jjb/functest/functest-cleanup.sh @@ -15,7 +15,10 @@ if [[ -n ${dangling_images} ]]; then echo " Removing $FUNCTEST_IMAGE:<none> images and their containers..." for image_id in "${dangling_images[@]}"; do echo " Removing image_id: $image_id and its containers" - docker ps -a | grep $image_id | awk '{print $1}'| xargs docker rm -f >${redirect} + containers=$(docker ps -a | grep $image_id | awk '{print $1}') + if [[ -n "$containers" ]];then + docker rm -f $containers >${redirect} + fi docker rmi $image_id >${redirect} done fi |