mirror of
https://github.com/mag37/dockcheck.git
synced 2026-04-19 10:57:45 +00:00
changed the RepoDigests grab and logic
This commit is contained in:
@@ -571,7 +571,9 @@ if [[ -n "${GotUpdates:-}" ]]; then
|
|||||||
|
|
||||||
# Add new backup tag prior to pulling if option is set
|
# Add new backup tag prior to pulling if option is set
|
||||||
if [[ -n "${DaysKept:-}" ]]; then
|
if [[ -n "${DaysKept:-}" ]]; then
|
||||||
ContRepoDigests=$(docker image inspect "$ImageId" --format "{{index .RepoDigests 0}}")
|
ImageConfig=$(docker image inspect "$ImageId" --format '{{ json . }}')
|
||||||
|
ContRepoDigests=$($jqbin -r '.RepoDigests[0]' <<< "$ImageConfig")
|
||||||
|
[[ "$ContRepoDigests" == "null" ]] && ContRepoDigests=""
|
||||||
ContRepo=${ContImage%:*}
|
ContRepo=${ContImage%:*}
|
||||||
ContApp=${ContRepo#*/}
|
ContApp=${ContRepo#*/}
|
||||||
[[ "$ContImage" =~ ":" ]] && ContTag=${ContImage#*:} || ContTag="latest"
|
[[ "$ContImage" =~ ":" ]] && ContTag=${ContImage#*:} || ContTag="latest"
|
||||||
@@ -593,7 +595,7 @@ if [[ -n "${GotUpdates:-}" ]]; then
|
|||||||
|
|
||||||
if docker pull "$ContImage"; then
|
if docker pull "$ContImage"; then
|
||||||
# Removal of the <none>-tag image left behind from backup
|
# Removal of the <none>-tag image left behind from backup
|
||||||
[[ -n "${DaysKept:-}" ]] && docker rmi "$ContRepoDigests"
|
if [[ ! -z "${ContRepoDigests:-}" ]] && [[ -n "${DaysKept:-}" ]]; then docker rmi "$ContRepoDigests"; fi
|
||||||
else
|
else
|
||||||
printf "\n%bDocker error, exiting!%b\n" "$c_red" "$c_reset" ; exit 1
|
printf "\n%bDocker error, exiting!%b\n" "$c_red" "$c_reset" ; exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user