mirror of
https://github.com/games-on-whales/LXC2Docker.git
synced 2026-10-15 12:52:04 +00:00
[PR #150] [MERGED] fix(images): stop reporting doubled image IDs and tag-strings as container IDs #149
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#149
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/150
Author: @JBailes
Created: 8/1/2026
Status: ✅ Merged
Merged: 8/1/2026
Merged by: @JBailes
Base:
main← Head:fix/image-id-double-prefix📝 Commits (1)
b34d540fix(images): stop reporting doubled image IDs and tag-strings as container IDs📊 Changes
4 files changed (+139 additions, -4 deletions)
View changed files
📝
internal/api/containers.go(+26 -1)➕
internal/api/image_id_prefix_test.go(+93 -0)📝
internal/api/images.go(+14 -1)📝
internal/lxc/manager.go(+6 -2)📄 Description
Two defects that between them make Docker's standard deploy-verification check impossible to pass against this daemon:
1. Doubled
sha256:on every pulled imagestore.ImageRecord.ConfigDigestis documented as "the 64-hex value; callers prefixsha256:", and all five readers do exactly that. Build and commit honour it viahex.EncodeToString. Pull, added inf2785c3, storesmanifest.Config.Digeststraight from the OCI manifest — which already carries the prefix.Observed on a live SmoothNAS host:
Fixed at both ends. Pull now stores bare hex per the contract, and
imageDisplayIDtrims a prefix defensively so records already persisted in the wrong format heal without a store migration — existing installs have bad values on disk, so the read-side fix is the one that actually repairs them.2. Container
.Imagereturned a reference, not an IDDocker keeps the reference in
.Config.Imageand the content-addressed ID in.Image. This daemon returnedrec.Image, the originalimage:tagstring, in both.ImageIDon the record is no better —containers.go:420sets it to the ref as well.inspectContainernow resolves the image record and reports"sha256:"+imageDisplayID, falling back to the reference when no record exists (legacy container, or the image has since been removed) rather than inventing a digest or returning empty..Config.Imageis unchanged and still carries the reference, which is correct.Why it matters
Found while verifying a container deploy, where the assertion reported
MISMATCHfor a correctly deployed container. That is the worst failure mode for a safety check: one that can only ever fail gets deleted or ignored, and then a genuine stale-image deploy goes through unnoticed.Testing
Both tests were written failing first and reproduce the exact strings observed on the host, plus the legacy fallback paths.
TestCheckCreateDiskPressureininternal/lxcfails identically on unmodifiedc76098e— verified against a clean baseline worktree, unrelated to this change.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.