0

I'm trying to push my container to the container registry but I'm seeing this error:

denied: Token exchange failed for project 'PROJECT-NAME'. Access denied.

I have set the correct project and have 'Owner' permissions. I have tried this in a couple of different projects with the same result. Container Registry API is enabled. Am I right in thinking that I should be able to do this without setting up a Service Account?

Alistair
  • 433
  • 7
  • 18
  • What the name of the image that you push? – guillaume blaquiere Dec 24 '21 at 11:26
  • Since, you are having the access denied error, the recommendation is to use Compute Engine default service account with least permissions. You may refer to a similar [Stackoverflow case](https://stackoverflow.com/questions/54014689/unable-to-push-to-google-container-registry-access-denied?rq=1). Let me know if that helps! – Mousumi Roy Dec 25 '21 at 09:12

1 Answers1

0

Please include the commands that you're using for full context.

You may need to authenticate the container runtime client (Docker? Podman?) to GCR:

GCR="us.gcr.io"

gcloud auth print-access-token \
| docker login \
  --username=oauth2accesstoken \
  --password-stdin \
  ${GCR}

# Then
docker push ${GCR}/${PROJECT}/...

Change ${GCR} as appropriate.

DazWilkin
  • 32,823
  • 5
  • 47
  • 88