docker buildx build --build-context no longer accepts a digest-only OCI layout reference in recent versions.
This appears to be a regression in v0.33.0. The same kind of reference worked in earlier versions, and the current documentation explicitly says an OCI layout source may be selected either by tag, or by digest:
Repro
Given a valid OCI layout directory whose index.json contains a descriptor with digest:
sha256:b58316e52c6138f698a0d273bef003fe7e190eef309284fe70e9443340a12c25
use it as a build context by digest only:
docker buildx build \
--build-context proxy=oci-layout:///home/alpeb/tmp/eraseme@sha256:b58316e52c6138f698a0d273bef003fe7e190eef309284fe70e9443340a12c25 \
.
The build fails with an invalid OCI layout reference:
ERROR: failed to build: failed to solve: could not parse oci-layout reference "bd9j5c2yxngk19855mg3droh0:@sha256:b58316e52c6138f698a0d273bef003fe7e190eef309284fe70e9443340a12c25": invalid reference format
Note that using an explicit tag works around the problem.
Likely cause
The regression seems consistent with the OCI-layout parsing/refactoring introduced around buildx v0.33.0, where digest-only refs can now retain an empty tag and later get re-serialized into an invalid :<empty>@<digest> form:
9894189361bc#diff-9e21a311718d1ef95e28d50d589895bb04cd41abf4149b0dbcca6b6b94e86bf9
docker buildx build --build-contextno longer accepts a digest-only OCI layout reference in recent versions.This appears to be a regression in
v0.33.0. The same kind of reference worked in earlier versions, and the current documentation explicitly says an OCI layout source may be selected either by tag, or by digest:Repro
Given a valid OCI layout directory whose
index.jsoncontains a descriptor with digest:use it as a build context by digest only:
docker buildx build \ --build-context proxy=oci-layout:///home/alpeb/tmp/eraseme@sha256:b58316e52c6138f698a0d273bef003fe7e190eef309284fe70e9443340a12c25 \ .The build fails with an invalid OCI layout reference:
Note that using an explicit tag works around the problem.
Likely cause
The regression seems consistent with the OCI-layout parsing/refactoring introduced around buildx
v0.33.0, where digest-only refs can now retain an empty tag and later get re-serialized into an invalid:<empty>@<digest>form:9894189361bc#diff-9e21a311718d1ef95e28d50d589895bb04cd41abf4149b0dbcca6b6b94e86bf9