Skip to content

fix(renovate): prune unused Docker images after recreating containers - #224

Merged
ineedjet merged 1 commit into
mainfrom
renovate-prune-unused-images
Oct 10, 2026
Merged

ineedjet merged 1 commit into
mainfrom
renovate-prune-unused-images

Conversation

@ineedjet

Copy link
Copy Markdown
Collaborator

Summary

  • renovate.py re-pulls and recreates each requested app's container, but never cleaned up the image layer it replaced
  • Over weeks of repeated renovate runs across several apps, dangling images accumulated on the target host until the disk filled - this is the production incident described in renovate action should prune old/unused Docker images after recreating containers #219 (hawkeye.dupmachine.com's root disk hit 100%, putting every Postgres-backed app into a crash loop)
  • deploy.py already runs this exact cleanup after every deploy (docker container prune -f && docker image prune -a -f); renovate.py was just missing the equivalent
  • Added prune_host(host), called once per host after that host's requested apps are all renovated - unconditionally, since the image needing cleanup is the previous run's leftover, not necessarily this run's own pull
  • docker image prune only removes images with no referencing container, so an image still backing a running container is never touched
  • Documented in the action's README

Closes #219

Test plan

  • .github/actions/renovate/tests - all 17 tests pass (added PruneHostTest + a dedicated "prunes each host once per invocation regardless of app count" case)
  • ruff check .github/actions/renovate/ passes

🤖 Generated with Claude Code

renovate.py pulled a fresh image and recreated each app's container but
never cleaned up the image it replaced. Over weeks of repeated runs
across several apps, dangling images accumulated on the target host
until the disk filled - observed in production on hawkeye.dupmachine.com,
where a full root disk put every Postgres-backed app into a crash loop.

deploy.py already runs this same cleanup after every deploy
(`docker container prune -f && docker image prune -a -f`); renovate.py
was just missing it. Add a prune_host() step, called once per host after
all of that host's requested apps have been renovated, regardless of
whether any of them actually changed - a previous run's now-superseded
image is what needs cleaning up, not necessarily this run's own pull.

Fixes #219

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@ineedjet
ineedjet merged commit 1dd99ca into main Oct 10, 2026
5 checks passed
@ineedjet
ineedjet deleted the renovate-prune-unused-images branch October 10, 2026 17:05
@ineedjet ineedjet mentioned this pull request Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

renovate action should prune old/unused Docker images after recreating containers

1 participant