containrrr / watchtower

A process for automating Docker container base image updates.
https://containrrr.dev/watchtower/
Apache License 2.0
19.1k stars 849 forks source link

Images retention options #2000

Open Tassleh0ff opened 3 months ago

Tassleh0ff commented 3 months ago

Is your feature request related to a problem? Please describe.

Recently one of the images I use in mu containers had an update which blocked the service because of a bug, but I can't start the container with the previous image because it was deleted by the WATCHTOWER_CLEANUP=true option.

Describe the solution you'd like

I would be useful if there's an option to set the number of images to retain on the system instead of delete all the images not used by some container, something like WATCHTOWER_CLEANUP_RETENTION with a number parameter. For example: WATCHTOWER_CLEANUP_RETENTION=N to retain the latest N images

Describe alternatives you've considered

As an alternative I have to disable the unused images deletion and make an external script to sort them out by date and manage the retention with it.

Additional context

No response

github-actions[bot] commented 3 months ago

Hi there! 👋🏼 As you're new to this repo, we'd like to suggest that you read our code of conduct as well as our contribution guidelines. Thanks a bunch for opening your first issue! 🙏