From e191971933f52aaf05f6a657455bf6745d5e6bdb Mon Sep 17 00:00:00 2001 From: mag37 Date: Fri, 21 Nov 2025 14:03:32 +0100 Subject: [PATCH] label-fix to fallback to default :latest when unset --- dockcheck.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dockcheck.sh b/dockcheck.sh index 0344289..c432775 100755 --- a/dockcheck.sh +++ b/dockcheck.sh @@ -560,7 +560,7 @@ if [[ -n "${GotUpdates:-}" ]]; then ContConfig=$(docker inspect "$i" --format '{{json .}}') ContImage=$($jqbin -r '."Config"."Image"' <<< "$ContConfig") # OLD? Remove if replaced with ContFull ImageId=$($jqbin -r '."Image"' <<< "$ContConfig") - ContFull=$(docker image inspect "$ImageId" --format "{{index .RepoTags 0}}") +# ContFull=$(docker image inspect "$ImageId" --format "{{index .RepoTags 0}}") ContPath=$($jqbin -r '."Config"."Labels"."com.docker.compose.project.working_dir"' <<< "$ContConfig") [[ "$ContPath" == "null" ]] && ContPath="" @@ -568,7 +568,7 @@ if [[ -n "${GotUpdates:-}" ]]; then if [[ -n "${DaysKept:-}" ]]; then ContRepo=${ContImage%:*} ContApp=${ContRepo#*/} - ContTag=${ContImage#*:} + [[ "$ContImage" =~ ":" ]] && ContTag=${ContImage#*:} || ContTag="latest" BackupName="dockcheck/${ContApp}:${RunTimestamp}_${ContTag}" docker tag "$ImageId" "$BackupName" printf "%b%s backed up as %s%b\n" "$c_teal" "$i" "$BackupName" "$c_reset"