Skip to content

Label to cleanup images by container #1691

Description

@DeltaTangoLima

Feature Request Checklist

Problem Description

I have three use cases I want to use Watchtower for:

✅ Auto pull and notify only

  • I use this for mission critical containers, so I can do controlled updates (eg. Pihole, Home Assistant, etc)
  • This is the smallest group of the three

✅ Auto pull, update containers, and notify

  • I use this for all other containers, as I don't mind taking the risk of auto-updating, but want the old image there in case I need to quickly rollback (eg. Immich, Forgejo, etc)
  • This would be a moderately sized group, if I had the below option

❌ Auto pull, update containers, cleanup old images, and notify

  • I want to use this for containers I don't really care about even having to rollback to the older version, I'll just forward fix the problem when I can, as they're not terribly important (eg. Calibre, Piped, etc)
  • Of my 40+ docker hosts, this group would represent the vast majority of containers, meaning less administrative overhead

Desired Solution

I'm asking for consideration of a container-level cleanup option, using a boolean label such as com.centurylinklabs.watchtower.cleanup

Current Alternatives or Workarounds

Scripted cleanup of specific containers' older images, but that isn't terribly compatible with my how I manage my docker fleet (40+ hosts) using Portainer.

Ideally, I'd comb my Discord messages each weekend (my Watchtower updates are cron'd for the early hours of Saturday morning), test the auto-updated containers, and only have to cleanup the two smaller groups of images as I go.

Additional Context

Understand this may not be possible without a significant rewrite of part of Watchtower. I haven't looked at the code myself, but I'm assuming the reason the cleanup option is host-wide is because Watchtower uses a docker prune (or similar) to achieve it.

If so, then what I'm asking for would require individual assessment at a container level to determine which older images should and shouldn't be removed.

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

Status
Feature Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions