Skip to content

fix(images): tolerate containers whose image record is gone - #14028

Open
ndeloof wants to merge 1 commit into
mainfrom
fix-images-missing-image-record
Open

fix(images): tolerate containers whose image record is gone#14028
ndeloof wants to merge 1 commit into
mainfrom
fix-images-missing-image-record

Conversation

@ndeloof

@ndeloof ndeloof commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

What I did
Make compose images tolerate containers whose image record no longer exists, instead of failing the whole listing with No such image.

A running container can legitimately reference a gone image record: under the containerd image store, up --build with 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 -f of 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 touch images.go); whichever merges second has a trivial rebase.

Covered by a unit test and an e2e test (up then rmi -f of 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

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>
@ndeloof
ndeloof requested review from a team as code owners August 11, 2026 13:08
@ndeloof
ndeloof requested a review from glours August 11, 2026 13:08
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.

[BUG] docker compose up --build does not restart containers if image ID changes, making docker compose images fail

1 participant