-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Contributing guidelines and issue reporting guide
- I've read the contributing guidelines and wholeheartedly agree. I've also read the issue reporting guide.
Well-formed report checklist
- I have found a bug that the documentation does not mention anything about my problem
- I have found a bug that there are no open or closed issues that are related to my problem
- I have provided version/information about my environment and done my best to provide a reproducer
Description of bug
Context
We have different organizations in Quay that have different tokens to be accessed. Until now, it isn't possible to separate auths by path, so with docker, we did something like this:
config.json
{
"auths": {
"my-registry.company:443/org1": {
"auth": "<token1>",
"email": ""
},
"my-registry.company/org2": {
"auth": "<token2>",
"email": ""
}
}
}
}
This is mostly used in CI systems on Gitlab and it allows to pull a base image from org2 and push a built image to org1 in the same go.
Bug description
With buildkit (docker-container driver), the above doesn't work and the push to my-registry.company:443/org1
fails with 401.
docker buildx build . -t my-registry.company:443/org1/my-image:test --push --platform linux/arm64,linux/amd
64
[+] Building 1.9s (25/25) FINISHED
[...]
=> [auth] org1/my-image:test:pull,push token for my-registry.company:443 0.0s
------
> exporting to image:
------
ERROR: failed to build: failed to solve: failed to push my-registry.company:443/org1/my-image:test: unauthorized: access to the requested resource is not authorized
buildkit logs:
time="2025-09-10T08:56:10Z" level=debug msg="do request" digest="sha256:5664b15f108bf9436ce3312090a767300800edbbfd4511aa1a6d64357024d5dd" mediatype=application/vnd.oci.image.layer.v1.tar+gzip request.header.accept="application/vnd.oci.image.layer.v1.tar+gzip, */*" request.header.user-agent=buildkit/v0.23 request.method=HEAD size=168 span="exporting to image" spanID=f845ea6fb73917fe traceID=eb861e1cf4d306150a82544b6b05b2ff url="https://my-registry.company:443/v2/org1/my-image/blobs/sha256:5664b15f108bf9436ce3312090a767300800edbbfd4511aa1a6d64357024d5dd"
time="2025-09-10T08:56:11Z" level=error msg="/moby.buildkit.v1.Control/Solve returned error: rpc error: code = Unknown desc = failed to push my-registry.company:443/org1/my-image:test: unauthorized: access to the requested resource is not authorized" spanID=694f67656c70a915 traceID=eb861e1cf4d306150a82544b6b05b2ff
failed to push my-registry.company:443/org1/my-image: unauthorized: access to the requested resource is not authorized
7 v0.23.2 buildkitd --config /etc/buildkit/buildkitd.toml --allow-insecure-entitlement=network.host
github.com/moby/buildkit/exporter/containerimage.(*imageExporterInstance).Export
This is very weird as it seems to pick the correct token/scope but it still doesn't work.
Reproduction
The simplest way to reproduce this is like this:
- Set up config.json for the same registry, once with a port and once without the port, using the same token.
{
"auths": {
"registry.company:443": {
"auth": "<token>",
"email": ""
},
"registry.company": {
"auth": "<token>",
"email": ""
},
}
}
- Run docker buildx for both registry entries.
docker buildx build -t registry.company/test --push --platform linux/arm64,linux/amd64
docker buildx build -t registry.company:443/test --push --platform linux/arm64,linux/amd64
The first one works, the second one will fail even though using the same token.
Version information
Docker version 28.3.3, build 980b856
buildkit/v0.23
I'm happy to provide more info but tried to keep it concise.