I have watchtower to keep my 50 production docker containers up to date. So far I have never had to resort to an old image since the new one was bugged but I know of the risks and dont have the --cleanup flag activated so I could easily spin up the old image if necessary. I also keep daily (mirrored) backups so I should be ok in the case of failure.

But I keep running into space issues due to multiple GBs of old images that I have to manually remove to not fill up the rather small ssd.

Does anyone have an idea how to automatically remove all but the newest unused docker image so I can quickly revert to it in case of failure but once there is another unused one of this container it goes away?

It’s probably no big deal but searching for it together with watchtower didnt yield anything so far.

Thanks in advance and have a good one.

  • Nouveau_Burnswick@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    5 months ago

    So my thought with the time based pruning is that you can keep a backup that’s X days old.

    Let’s say you keep 2 weeks. If there have been no problems with an image after 2 weeks of an update, you’re probably good to go. If you have an issue during those 2 weeks, you can return to and image within those 2 weeks. If you’ve had no problems after 2 weeks, it’s probably stable.

    Adjust 2 weeks to whatever you’re comfortable with.

    • hauiOPA
      link
      fedilink
      English
      arrow-up
      1
      ·
      5 months ago

      This would absolutely make sense, were it not for the fact that the old image can be 3 weeks old when the new one comes out. Feel free to correct me but I think a time based option on age is not sufficient.