mirror of
https://github.com/games-on-whales/LXC2Docker.git
synced 2026-10-15 12:52:04 +00:00
[PR #88] [MERGED] fix(reuse): re-clone warm rootfs when a :latest tag is repointed to a new digest #88
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
games-on-whales/LXC2Docker#88
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/games-on-whales/LXC2Docker/pull/88
Author: @JBailes
Created: 6/16/2026
Status: ✅ Merged
Merged: 6/16/2026
Merged by: @JBailes
Base:
main← Head:fix/warm-reuse-digest-drift📝 Commits (1)
7be8a07fix(reuse): re-clone warm rootfs when a mutable tag is repointed to a new digest📊 Changes
3 files changed (+73 additions, -1 deletions)
View changed files
📝
internal/api/containers.go(+27 -1)📝
internal/api/containers_reuse_test.go(+40 -0)📝
internal/store/store.go(+6 -0)📄 Description
The bug
Warm container reuse (
DLD_REUSE_CONTAINERS) adopts a stopped container's warm rootfs instead of cloning fresh, gated byreusableContainer. That guard only compared the image ref:For a mutable tag like
:latest, the ref string is identical after the image is updated to a new digest — so the stale warm rootfs is reused and the container silently runs the OLD image content, even though the daemon already pulled the new image and refreshed the template.Observed in the field: an
aimee-kbcontainer kept running a pre-update binary (missing a merged change) after its:latestimage was bumped — it was recreated-with-reuse, so it adopted the old rootfs rather than cloning from the current template. (Diagnosed bygrep-ing the dispatch-string in the image binary [present] vs the running container binary [absent], with local image digest == ghcr:latest.)The fix
Track the digest each warm rootfs was cloned from and reuse only when it still matches:
store.ContainerRecord.ImageDigest— the image's resolved manifest digest at create time.createContainerrecords it (= image.RepoDigest, whichbdf5f12already refreshes on pull).reusableContainerreuses only whenold.ImageDigestis known, equals the image's currentRepoDigest; otherwise (drift, or either side unknown) clone fresh. Logs on drift.This is conservative by design: a rootfs we can't confirm is current is never adopted. (One-time effect: pre-existing containers with no recorded digest clone fresh on their next reuse — which also picks up any image they were stale against.)
Tests
TestReusableContainerDigestDrift: digest drift, unknown clone-time digest (legacy), and unknown current digest all correctly return not-reusable.go build,go vet, andgo test ./...all green.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.