full name with tags when used as context with platform results in unresolvable image
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- docker, go
- Domain
- build-system, devtools
Research direction
Start with the Dockerfile FROM cases and the buildctl commands in the report, comparing context resolution for chain/chain:abc and docker.io/chain/chain:abc with both oci-layout and docker-image contexts. Trace the image-name matching and platform resolution path; done means the fully qualified name resolves the supplied context instead of attempting an unauthorized registry pull.
Written by the indexing model from the issue text.
Description
Problem: passing a fully qualified image name to a context makes it unable to resolve, at least when passing the platform. Holds true for both oci-layout context and docker-image context.
For docker-image, I will just alias to docker.io/library/alpine:3.16; for oci-layout, I have a layout directory with just a few files in it. The important one is the OCI index, at /tmp/cache/blobs/sha256/bd04a5b26dec16579cd1d7322e949c5905c4742269663fcbc84dcb2e9f4592fb.
Single name, no qualifier or tags (works)
Create a Dockerfile:
FROM --platform=linux/amd64 chain as src
and try to build from it. It works:
$ image=chain
$ buildctl build --frontend dockerfile.v0 --output type=image,name=docker.io/foo/bar --local context=/tmp/build/b2 --local dockerfile=/tmp/build/b2 --opt context:${image}=oci-layout://dump@sha256:bd04a5b26dec16579cd1d7322e949c5905c4742269663fcbc84dcb2e9f4592fb --oci-layout dump=/tmp/cache
$ buildctl build --frontend dockerfile.v0 --output type=image,name=docker.io/foo/bar --local context=/tmp/build/b2 --local dockerfile=/tmp/build/b2 --opt context:${image}=docker-image://docker.io/library/alpine:3.16
Repo name with org (works)
I change the source image to chain/chain in the dockerfile and run again. That works:
FROM --platform=linux/amd64 chain/chain as src
$ image=chain/chain
$ buildctl build --frontend dockerfile.v0 --output type=image,name=docker.io/foo/bar --local context=/tmp/build/b2 --local dockerfile=/tmp/build/b2 --opt context:${image}=oci-layout://dump@sha256:bd04a5b26dec16579cd1d7322e949c5905c4742269663fcbc84dcb2e9f4592fb --oci-layout dump=/tmp/cache
$ buildctl build --frontend dockerfile.v0 --output type=image,name=docker.io/foo/bar --local context=/tmp/build/b2 --local dockerfile=/tmp/build/b2 --opt context:${image}=docker-image://docker.io/library/alpine:3.16
Org and repo with tag (works)
I change the source image to chain/chain:abc in the dockerfile and run again. That works.
FROM --platform=linux/amd64 chain/chain:abc as src
$ image=chain/chain:abc
$ buildctl build --frontend dockerfile.v0 --output type=image,name=docker.io/foo/bar --local context=/tmp/build/b2 --local dockerfile=/tmp/build/b2 --opt context:${image}=oci-layout://dump@sha256:bd04a5b26dec16579cd1d7322e949c5905c4742269663fcbc84dcb2e9f4592fb --oci-layout dump=/tmp/cache
$ buildctl build --frontend dockerfile.v0 --output type=image,name=docker.io/foo/bar --local context=/tmp/build/b2 --local dockerfile=/tmp/build/b2 --opt context:${image}=docker-image://docker.io/library/alpine:3.16
Fully qualified name (fails)
Finally, I fully qualify it to docker.io/chain/chain:abc in the dockerfile and run again. That blows up:
FROM --platform=linux/amd64 docker.io/chain/chain:abc as src
$ image=docker.io/chain/chain:abc
$ buildctl build --frontend dockerfile.v0 --output type=image,name=docker.io/foo/bar --local context=/tmp/build/b2 --local dockerfile=/tmp/build/b2 --opt context:${image}=oci-layout://dump@sha256:bd04a5b26dec16579cd1d7322e949c5905c4742269663fcbc84dcb2e9f4592fb --oci-layout dump=/tmp/cache
[+] Building 0.2s (4/4) FINISHED
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 99B 0.0s
=> ERROR [internal] load metadata for docker.io/chain/chain:abc 0.2s
=> [auth] chain/chain:pull token for registry-1.docker.io 0.0s
------
> [internal] load metadata for docker.io/chain/chain:abc:
------
Dockerfile:1
--------------------
1 | >>> FROM --platform=linux/amd64 docker.io/chain/chain:abc as src
2 |
3 |
--------------------
error: failed to solve: docker.io/chain/chain:abc: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
buildctl build --frontend dockerfile.v0 --output type=image,name=docker.io/foo/bar --local context=/tmp/build/b2 --local doc
kerfile=/tmp/build/b2 --opt context:${image}=docker-image://docker.io/library/alpine:3.16
[+] Building 0.2s (4/4) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 99B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> ERROR [internal] load metadata for docker.io/chain/chain:abc 0.2s
=> [auth] chain/chain:pull token for registry-1.docker.io 0.0s
------
> [internal] load metadata for docker.io/chain/chain:abc:
------
Dockerfile:1
--------------------
1 | >>> FROM --platform=linux/amd64 docker.io/chain/chain:abc as src
2 |
3 |
--------------------
error: failed to solve: docker.io/chain/chain:abc: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
Ignoring for a moment the fact that chain/chain:abc = docker.io/chain/chain:abc, why is this not accepting docker.io?
- Dominant language
- Go
- Stars
- 10.3k
- Forks
- 1.5k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 48
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from moby/buildkit
-
status/triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
area/dockerfile
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Similar issues
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
blinklabs-io/bursa#904 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
yanet-platform/ipfw-go#129 ·
-
bug confmap/provider/googlesecretmanagerprovider needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
open-telemetry/opentelemetry-collector-contrib#51273 · 2 comments ·
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100