Closed dtretyakov closed 1 year ago
What kind of private registry is this? Is that a self-hosted registry? Is so, what kind of registry?
This error looks to be coming from the registry
Hey @thaJeztah, I can reproduce this issue with the following public gcr.io
image: gcr.io/spotinst-artifacts/kubernetes-cluster-controller:1.0.94
.
When I try to run docker manifest inspect gcr.io/spotinst-artifacts/kubernetes-cluster-controller:1.0.94
I get the following error:
Get "https://gcr.io/v2/spotinst-artifacts/kubernetes-cluster-controller/manifests/1.0.94": unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication
Actually I tried to debug the docker cli and saw that we try to create a registry token before making the GET https://gcr.io/v2/spotinst-artifacts/kubernetes-cluster-controller/manifests/1.0.94
request and saw that we try to create a token with both the pull
and push
scopes, when in fact we only the pull
scope is required for getting the manifest. Adding the push
scope is what's causing the token creation request to fail.
The problematic code is located here: https://github.com/docker/cli/blob/7d723e2ba7b8607cf9ca5b3ea541f1ce60c700ec/cli/registry/client/endpoint.go#L102
I used version: Docker version 20.10.24, build 297e128
, But this is still the case with the code master
branch.
Please let me know if you need additional information.
what could be the possible resolution for this? Please advise, I was able to fix this by creating a user in docker hub and generating access token for that user with full permission (Read, write and Delete) and embedded docker login in the script. Then I was able to get the result for docker manifest inspect but the token should have full permissions, but for a public repository or images that are publicly available I was able to pull them without any issues (using docker pull). The issue is only with docker manifest inspect command along.
Description
Steps:
docker manifest inspect
some image in the this registryAR:
Underneath it sends the following request to the registry:
ER: It requires the same permissions as
docker login xxx
Reproduce
docker login xxx
docker manifest inspect xxx
Expected behavior
No response
docker version
docker info
Additional Info
No response