If deleting specified images fails then try deleting all images instead.

This might be needed if we hit the 'image has dependent child images' issue.
This commit is contained in:
Tom Page
2020-04-03 11:41:48 +01:00
parent f69718de64
commit 8a9b784683

View File

@@ -10,5 +10,11 @@ if [ "$docker_images_list" == "" ]; then
echo "No docker images on the agent" echo "No docker images on the agent"
else else
echo "Clearing images: $docker_images_list" echo "Clearing images: $docker_images_list"
if docker rmi -f $docker_images_list ; then
echo "Deleting images was successful."
else
echo "Deleting specified images failed, so falling back to delete ALL images on system."
docker_images_list=$(docker images | awk '{print $3}' | uniq)
docker rmi -f $docker_images_list docker rmi -f $docker_images_list
fi fi
fi