go-containerregistry
go-containerregistry copied to clipboard
crane: should support multiple credentials to the same registry
Describe the bug
When trying to pull an image from a registry ie quay.io with an auth file that contains multiple entries for the same registry, crane gives an UNATHORIZED error.
To Reproduce
- Have access to a registry with different accounts for different namespaces/images
- Create an auth file with multiple entries for the same registry
{
"auths": {
"quay.io/telcoci/simple-demo-operator-bundle": {
"auth": "XXXXXX"
},
"quay.io/telcoci": {
"auth": "YYYYYY"
},
"quay.io": {
"auth": "ZZZZZZ"
}
}
}
- Run
crane pull quay.io/telcoci/simple-demo-operator-catalog:0.0.3(as an example) - See an error of
Error: GET https://quay.io/v2/telcoci/simple-demo-operator-catalog/manifests/0.0.3: UNAUTHORIZED: access to the requested resource is not authorized; map[]
Expected behavior
I'd expect crane to be able to use the proper auth value like podman, skopeo, buildah, etc.
Additional context
This also does not work when using the crane api's. We are using crane as a library for a go based project found here, so should be implemented in the cli as well as the api.
This also might relate to:
- #723
but I think crane cli cmds use the files in the authn pkg
- Output of
crane version:0.8.0 - Registry used (e.g., GCR, ECR, Quay):
quaybut I assume this exists for all registries.