Skip to content

fix(oci): support single-post blob upload to fix BuildKit config blob unknown#55

Merged
The127 merged 1 commit intomasterfrom
fix/buildkit-config-blob-unknown
Apr 17, 2026
Merged

fix(oci): support single-post blob upload to fix BuildKit config blob unknown#55
The127 merged 1 commit intomasterfrom
fix/buildkit-config-blob-unknown

Conversation

@The127
Copy link
Copy Markdown
Owner

@The127 The127 commented Apr 17, 2026

Summary

  • Docker 23+ BuildKit uses single-post blob upload (POST /v2/.../blobs/uploads/?digest=sha256:... with the blob body inline) for small blobs such as the image config. The registry was returning 400 UNSUPPORTED, which containerd silently treated as a skip, leaving the config blob off repository_blobs and causing unknown blob on pull.
  • Layers were unaffected because they are large and always go through the normal PATCH+PUT chunked path.
  • Workaround was DOCKER_BUILDKIT=0.

Changes

  • BlobsUploadStart: when ?digest= is present, upload the full body via UploadCompleteBlob, create the repository_blobs entry, and return 201 Created — matching OCI Distribution Spec single-post upload semantics.
  • repository_blobs insert: add ON CONFLICT (repository_id, blob_id) DO NOTHING so concurrent or retry uploads of the same blob don't fail the transaction.
  • BlobsDownload: fix two missing return statements after error handling that caused nil-pointer panics.
  • UploadCompleteBlob: track byte count via countReader and expose as Size on the response so the blob DB record gets the correct size.

Test plan

  • docker build with default BuildKit (Docker 23+) and push to registry — pull should succeed
  • Confirm DOCKER_BUILDKIT=0 path still works
  • Push same image twice (re-push) — no unique constraint errors

… unknown

Docker 23+ BuildKit uses single-post upload (POST /blobs/uploads/?digest=...)
for small blobs like the image config. The registry was returning 400 UNSUPPORTED,
which containerd treated as a non-retryable failure and silently skipped the blob,
leaving the config unreferenced in repository_blobs and causing unknown blob on pull.

- Handle single-post upload in BlobsUploadStart: read body, verify digest, store blob
- Add ON CONFLICT DO NOTHING to repository_blobs insert for idempotency
- Fix missing return statements in BlobsDownload after error handling
- Track byte count in UploadCompleteBlob to populate blob size
@The127 The127 merged commit 758a768 into master Apr 17, 2026
6 checks passed
@The127 The127 deleted the fix/buildkit-config-blob-unknown branch April 17, 2026 10:33
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.

1 participant