Brian Barnes
Brian Barnes

Reputation: 397

Error pulling docker image from GCR: "You don't have the needed permissions to perform this operation, and you may have invalid credentials."

I am SSH'd into a GCE instance in Project A whose service account has Storage Admin access in Project B, where Image Foo is located. When I run docker build . from the command line of my GCE instance, I get the above error when docker tries to pull Image Foo from Project B. I have configured docker according to the instructions in the link, and authenticated using gcloud.

Upvotes: 8

Views: 4781

Answers (1)

DazWilkin
DazWilkin

Reputation: 40326

I suspect it's one or two of two things:

First, check which account you're running under on the VM (gcloud auth list). It's probably the VM's service account not your user account. This is the account that needs to be IAM'd to the bucket;

Second, ensure you've configured docker to access the account's credentials for GCR (if possible: gcloud auth configure-docker).

Then, it should work.

I repro'd your error and applied these changes and it works (link)

Upvotes: 2

Related Questions