mirror of
https://github.com/mag37/dockcheck.git
synced 2026-04-19 02:47:45 +00:00
Add auto-prune to be possible without any other interactions.
This commit is contained in:
10
dockcheck.sh
10
dockcheck.sh
@@ -705,7 +705,7 @@ if [[ -n "${GotUpdates:-}" ]]; then
|
|||||||
# Trigger pruning only when backup-function is not used
|
# Trigger pruning only when backup-function is not used
|
||||||
if [[ -z "${BackupForDays:-}" ]]; then
|
if [[ -z "${BackupForDays:-}" ]]; then
|
||||||
if [[ "$AutoPrune" == false ]] && [[ "$AutoMode" == false ]]; then printf "\n"; read -rep "Would you like to prune all dangling images? y/[n]: " AutoPrune; fi
|
if [[ "$AutoPrune" == false ]] && [[ "$AutoMode" == false ]]; then printf "\n"; read -rep "Would you like to prune all dangling images? y/[n]: " AutoPrune; fi
|
||||||
if [[ "$AutoPrune" == true ]] || [[ "$AutoPrune" =~ [yY] ]]; then printf "\nAuto pruning.."; docker image prune -f; fi
|
if [[ "$AutoPrune" == true ]] || [[ "$AutoPrune" =~ [yY] ]]; then printf "\nAuto pruning.."; docker image prune -f && AlreadyPruned="true" ; fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
@@ -715,7 +715,11 @@ else
|
|||||||
printf "\nNo updates available.\n"
|
printf "\nNo updates available.\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Clean up old backup image tags if -b is used
|
# Clean up old backup image tags if -b is used otherwise prune if auto-prune is set
|
||||||
[[ -n "${BackupForDays:-}" ]] && remove_backups
|
if [[ -n "${BackupForDays:-}" ]]; then
|
||||||
|
remove_backups
|
||||||
|
else
|
||||||
|
if [[ "$AutoPrune" == true ]] && [[ "${AlreadyPruned:=false}" != true ]]; then printf "\nAuto pruning.."; docker image prune -f; fi
|
||||||
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user