mirror of
https://github.com/mag37/dockcheck.git
synced 2026-04-19 10:57:45 +00:00
moved the prune logic and made a forced prune with -k flag
This commit is contained in:
22
dockcheck.sh
22
dockcheck.sh
@@ -636,12 +636,6 @@ if [[ -n "${GotUpdates:-}" ]]; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
printf "\n%bAll updates done!%b\n" "$c_green" "$c_reset"
|
printf "\n%bAll updates done!%b\n" "$c_green" "$c_reset"
|
||||||
else
|
|
||||||
printf "\nNo updates installed.\n"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
printf "\nNo updates available.\n"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Clean up old backup image tags if -k is used
|
# Clean up old backup image tags if -k is used
|
||||||
if [[ -n "${DaysKept:-}" ]]; then
|
if [[ -n "${DaysKept:-}" ]]; then
|
||||||
@@ -657,11 +651,23 @@ if [[ -n "${DaysKept:-}" ]]; then
|
|||||||
docker rmi "${repo_name}:${backup_tag}" && ((CleanupCount+=1))
|
docker rmi "${repo_name}:${backup_tag}" && ((CleanupCount+=1))
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
[[ "$CleanupCount" == 0 ]] && printf "No backup images to remove.\n" || printf "%b%s%b backup images removed.%b\n" "$c_green" "$CleanupCount" "$c_teal" "$c_reset"
|
|
||||||
unset IFS
|
unset IFS
|
||||||
|
if [[ "$CleanupCount" == 0 ]]; then
|
||||||
|
printf "No backup images to remove.\n"
|
||||||
|
else
|
||||||
|
printf "%b%s%b backup images removed.%b\n" "$c_green" "$CleanupCount" "$c_teal" "$c_reset"
|
||||||
|
docker image prune -f
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
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; fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
printf "\nNo updates installed.\n"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
printf "\nNo updates available.\n"
|
||||||
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user