Remove the old image after a container update, like Watchtower's --cleanup
Author: tikhonpCreated Oct 1, 2026Updated Oct 1, 2026
Labelsenhancement
Describe the feature you would like to see
I'm moving from Watchtower to Dozzle's container updates. One thing I miss is cleanup. Watchtower has a --cleanup option: after it updates a container, it deletes the old image that container was using. Dozzle leaves the old image on disk, so on a small server they keep piling up, a few hundred MB at a time, until the disk fills or I prune by hand.
Describe how you would like to see this feature implemented
Two ways this could work
- Clean up after each update. When Dozzle updates a container and the new one starts fine, it removes the old image if nothing else uses it.
- Prune on a schedule. Run something like docker image prune every day or week.
I think option 1 is better, at least for automatic updates:
- It only touches images that Dozzle itself replaced. It never deletes something I pulled or built myself and haven't used yet.
- It's what Watchtower users already expect.
- It's easy to understand: the update happens and the old image is gone.
Option 2 is easy to do already with cron or docker image prune. It's also riskier, because it removes images that have nothing to do with Dozzle.
How I imagine it
- A setting like DOZZLE_AUTO_UPDATE_CLEANUP=true, off by default, used for scheduled auto-updates. It could also be used for manual and bulk updates, or have a separate switch for those.
- Remove the old image only if no other container (running or stopped) uses it. If removal fails, just log it. Don't fail the update.
- It should also work on agents, since the update runs there.
Describe any alternatives you've considered
Described above
Source: amir20/dozzle