mirror of
https://github.com/games-on-whales/LXC2Docker.git
synced 2026-10-15 12:52:04 +00:00
[PR #126] [MERGED] fix(images): real sha256 config-digest image IDs (commit + infra) #126
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#126
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/126
Author: @JBailes
Created: 7/1/2026
Status: ✅ Merged
Merged: 7/1/2026
Merged by: @JBailes
Base:
main← Head:fix/config-digest-commit📝 Commits (2)
228cce8fix(images): real sha256 config-digest image IDs (commit + infra)1e4d9b9fix commit config-digest to hash the committed snapshot, not the source📊 Changes
7 files changed (+132 additions, -16 deletions)
View changed files
➕
internal/api/config_digest_test.go(+55 -0)📝
internal/api/image_save.go(+36 -0)📝
internal/api/images.go(+16 -5)📝
internal/api/portainer.go(+1 -3)📝
internal/api/portainer_ops.go(+12 -1)📝
internal/api/system.go(+8 -7)📝
internal/store/store.go(+4 -0)📄 Description
Design-approved deferred item (Option A), part 1 of 2 — commit + shared infra. Build's
aux.IDfollows in a separate PR.Problem
POST /commitreturnedId: "sha256:commit_<uuid>"— not a real digest, sodocker inspect <that-id>failed. Docker's image ID is the sha256 of the image's OCI config JSON.Fix
store.ImageRecord.ConfigDigest(64-hex;omitempty) andcomputeConfigDigest(rec)— reuses the existing save pipeline (openImageRootfs+writeLayerTar+synthesiseImageConfig), so the stored digest equals the<config>.jsonnamedocker savewould write (self-consistent).sha256:<digest>.imageDisplayID(rec)(config digest when known, else the internal id for legacy records): inspectId,/images/json,/system/df, image history, and the rmiDeletedline.findImageByIDnow also matchesConfigDigest(exact + ≥4-char prefix), sodocker inspect/rmiby the digest resolve.Design notes / blast radius
ConfigDigestfalls back torec.IDat every display site (byte-identical output for pulled/distro/loaded images).rec.IDremains the internal grouping/lookup key (listImages/df grouping,imageRefsForID, rmi untag) — not touched.ConfigDigestis 1:1 withrec.ID(copied ondocker tag), so grouping stays consistent.RootFS.Layers(a layer diff-id placeholder, not the image ID) is intentionally left as-is.Tests
config_digest_test.go—imageDisplayID(digest wins / legacy fallback) andfindImageByIDresolving by full digest (±sha256:), short prefix, and still by internal id.The
computeConfigDigesttar pass needs a live rootfs (like the existing save/commit tests), so it's verified by reasoning + integration CI.go test ./...,go vet,gofmt,go buildclean. Merge only on verified-green CI.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.