+# clean up dependent project docker images, which has no containers and image tag None
+clean_images=(opnfv/functest opnfv/yardstick opnfv/testapi mongo)
+for clean_image in "${clean_images[@]}"; do
+ dangling_images=($(docker images -f "dangling=true" | grep ${clean_image} | awk '{print $3}'))
+ if [[ -n ${dangling_images} ]]; then
+ for image_id in "${dangling_images[@]}"; do
+ echo "Removing image $image_id, which has no containers and image tag is None"
+ docker rmi $image_id >${redirect}
+ done
+ fi
+done
+
+echo "Remove dovetail images with tag None and containers with these images ..."
+dangling_images=($(docker images -f "dangling=true" | grep opnfv/dovetail | awk '{print $3}'))
+if [[ -n ${dangling_images} ]]; then
+ for image_id in "${dangling_images[@]}"; do
+ echo "Removing image $image_id with tag None and its related containers"
+ docker ps -a | grep $image_id | awk '{print $1}'| xargs docker rm -f >${redirect}
+ docker rmi $image_id >${redirect}
+ done
+fi
+
+echo "Cleaning up dovetail docker containers..."