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