#1955
Rollback retention never removes registry-pulled release images; old Openship images and unused build cache pile up on every connected server
Summary
Rollback retention keeps the database in sync, but some images never leave the disk:
- Release images pulled from a registry (projects that deploy a prebuilt image by digest). Releases past the rollback window get
artifactRetainedAtcleared, but the pulled image stays on the host forever. - Older Openship component images (
openship-api,openship-dashboard,openship-edge,openship-buildkit) stay after every self-update and on every connected server. - Build cache and other unused images on connected (SSH) deploy servers grow with no operator-visible cap or way to prune them.
So the rollback window limits the bookkeeping, not the disk. On one instance this reached about 240 GB reclaimable.
Observed (self-hosted, Docker runtime, 1 local + 2 SSH-connected deploy servers)
Local server. One project deploys ghcr.io/<owner>/<app>@sha256:… (~3.6 GB per image), with a rollback window of 5 (instance default):
Images 168 total 26 active 258.7GB 241.9GB reclaimable (93%)- 61 untagged
ghcr.io/<owner>/<app>images (one per release, ~220 GB). 1 is in use. Openship marks 6 releases as retained, which is correct. - 9 copies each of
openship-api,openship-dashboardandopenship-edge. Only the running version is in use.
Connected server A:
Images 98 total 17 active 56.28GB 36.37GB reclaimable (64%)- 9 pulled
ghcr.io/<owner>/<runner>images, 6openship-edgeand 6openship-buildkitimages.
Connected server B:
Images 58 total 5 active 43.68GB 30.02GB reclaimable (68%)
Build Cache 154 entries 0 active 43.67GBCause
Both cleanup paths only consider images Openship built itself:
pruneUnlocked(rollback/rollback-orchestrator.ts) passesimageReftoruntime.purge.DockerRuntimeonly removes it whenownsBuiltImage(imageRef)(packages/adapters/src/runtime/docker.ts).images:gc/reapProjectImagesonly lists images labelledopenship.project. Pulled images never carry that label.
So a registry-pulled release image is never a removal candidate, even after its release leaves the keep-set. Nothing removes Openship's own superseded component images, either locally or on connected servers.
Expected
- Pulled release images follow the same keep-set as built images: the active release, pinned releases and the newest
rollbackWindowreleases. When a release leaves the window, its pulled image is removed by exact digest, unless a kept release, another project or a running container still references it. Rolling back to a purged release re-pulls it by digest. - Openship component images: after a successful upgrade, keep the running version plus the previous one (for rollback) and remove older ones. This applies on the control-plane host and on every connected server (edge, buildkit, etc.).
- Per-server maintenance prune: a scheduled job plus a manual "Reclaim disk" action (UI, CLI and API) for each connected server, roughly a safe, scoped
docker system prune:- dangling images, unused build cache above a per-server budget (
buildCacheBudgetBytesalready exists), and stopped containers Openship created; - never volumes, and never images or containers Openship doesn't recognise, unless the operator opts in;
- a dry-run preview showing candidates, size and the keep/delete reason (overlaps #779).
- dangling images, unused build cache above a per-server budget (
Suggested approach
- At pull time, record pulled image digests as release artifacts, or give them an Openship-owned local tag or label such as
openship/pulled/<project>:<deployment>. That wayownsBuiltImage/listProjectImagesand theimages:gcsweep include them. - Remove only the exact digest. Skip it when it's in use (the daemon's 409 is the backstop).
- Run
images:gcand the new component and cache prune against every server that hosts Openship workloads, not only the local daemon.
Related
- #779: image retention visibility and age-based cleanup. It treats third-party images as out of scope, and pulled release images currently fall into that bucket.
- #1346, #1839: rollback retention sizing.
- #815, #1643: build cache retention.
Activity
0No activity yet.