X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Ffunctest%2Ffunctest-cleanup.sh;h=fc277b9ed621c4266c5baa47c3f60961e928b981;hb=6b50609d6ffb5e6ab81b0ad5d8c33e1a49bfd6c2;hp=3ef9b90ddad22c1149ce2c0c8b55b23c7bbbbbc4;hpb=1e2f80cdd0938a78dbbc3253f11f6ea8662d7d87;p=releng.git 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: 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