fix(images): tolerate containers whose image record is gone - #14028
Open
ndeloof wants to merge 1 commit into
Open
fix(images): tolerate containers whose image record is gone#14028ndeloof wants to merge 1 commit into
ndeloof wants to merge 1 commit into
Conversation
A running container may reference an image record that no longer exists: under the containerd image store, `up --build` with identical content moves the tag to a new index digest (provenance attestation churn) and the daemon drops the old index the container was created from — without compose recreating the container, by design (#13636). `docker rmi -f` of a running container's image produces the same state. `compose images` used to fail the whole listing on the resulting NotFound. Degrade to what the container itself knows (image ID, and repository/tag when the reference is not a raw ID) instead of failing. Fixes #14014 Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What I did
Make
compose imagestolerate containers whose image record no longer exists, instead of failing the whole listing withNo such image.A running container can legitimately reference a gone image record: under the containerd image store,
up --buildwith identical content produces a new index digest (provenance attestation churn), the tag moves, and the daemon drops the old dangling index the container was created from;docker rmi -fof a running container's image produces the same state.Images()now degrades such entries to what the container itself knows (image ID, plus repository/tag when the recorded reference is not a raw ID) rather than propagating the NotFound.Interaction with #14011 — and why this fix shape
Same root family (image-identity digests under the containerd store), but a surface #14011 doesn't touch: the failure reproduces identically with #14011's build. Not recreating the container when only the index digest changes is by design (#13636), an invariant #14011 locks in (
TestUpIdempotentContainerdStore) — so a container running a vanished image record is a legitimate, durable state, and "recreate when the record is gone" would reintroduce the rebuild churn #13636/#14011 eliminate. Making the listing resilient is the only fix shape consistent with #14011. Overlap is textual only (both touchimages.go); whichever merges second has a trivial rebase.Covered by a unit test and an e2e test (
upthenrmi -fof the running container's image — the deterministic way to reach the state). The e2e test only bites under the containerd image store: it needs the CI matrix from #14027 (or #14011's containerd job) to be exercised in CI.Related issue
Fixes #14014