From 5a19cebfd770aac59c6b3d42943f033cad45a4ba Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 5 Aug 2021 17:48:09 -0400 Subject: [PATCH] fix: do not mark images dead when they still have tags --- plugins/scheduler-docker-local/internal-functions | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/scheduler-docker-local/internal-functions b/plugins/scheduler-docker-local/internal-functions index cf07b1dd2..d11e966fb 100755 --- a/plugins/scheduler-docker-local/internal-functions +++ b/plugins/scheduler-docker-local/internal-functions @@ -184,8 +184,14 @@ fn-scheduler-docker-local-retire-images() { fi if echo "$RM_OUTPUT" | grep -q "image has dependent child images"; then - dokku_log_warn "Image ${IMAGE_ID} has children images, skipping rm and marking dead" - DEAD_IMAGES+=("$IMAGE_ID") + TAG_COUNT="$(docker inspect "$IMAGE_ID" --format '{{ json .RepoTags }}' | jq '. | length')" + if [[ "$TAG_COUNT" -eq 0 ]]; then + dokku_log_warn "Image ${IMAGE_ID} has children images and is untagged, skipping rm and marking dead" + DEAD_IMAGES+=("$IMAGE_ID") + continue + fi + + dokku_log_warn "Image ${IMAGE_ID} has children images and has $TAG_COUNT tags, skipping rm" continue fi