mirror of
https://github.com/mag37/dockcheck.git
synced 2026-02-14 15:28:22 +01:00
Test to remove the <none>-tagged copy after backup is created
This commit is contained in:
parent
85e2b2c02c
commit
160f4a2c5f
1 changed files with 8 additions and 1 deletions
|
|
@ -562,6 +562,7 @@ if [[ -n "${GotUpdates:-}" ]]; then
|
|||
|
||||
# Add new backup tag prior to pulling if option is set
|
||||
if [[ -n "${DaysKept:-}" ]]; then
|
||||
ContRepoDigests=$(docker image inspect "$ImageId" --format "{{index .RepoDigests 0}}")
|
||||
ContRepo=${ContImage%:*}
|
||||
ContApp=${ContRepo#*/}
|
||||
[[ "$ContImage" =~ ":" ]] && ContTag=${ContImage#*:} || ContTag="latest"
|
||||
|
|
@ -581,7 +582,13 @@ if [[ -n "${GotUpdates:-}" ]]; then
|
|||
continue
|
||||
fi
|
||||
|
||||
docker pull "$ContImage" || { printf "\n%bDocker error, exiting!%b\n" "$c_red" "$c_reset" ; exit 1; }
|
||||
if docker pull "$ContImage"; then
|
||||
# Removal of the <none>-tag image left behind from backup
|
||||
[[ -n "${DaysKept:-}" ]] && docker rmi "$ContRepoDigests"
|
||||
else
|
||||
printf "\n%bDocker error, exiting!%b\n" "$c_red" "$c_reset" ; exit 1
|
||||
fi
|
||||
|
||||
done
|
||||
printf "\n%bDone pulling updates.%b\n" "$c_green" "$c_reset"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue