Closed RsknCankov closed 6 years ago
This sounds similar to this issue: https://stackoverflow.com/questions/51236449/unable-to-pull-image-from-private-gcr-from-container-optimized-compute-engine
Are you running docker pull
:
gcloud
SDK?docker-credential-gcr gcr-login
?If you aren't using sudo
to run docker, it looks like the cred helper was configured properly.
Here are my steps:
I then removed and created a new machine and tried to get authentication with the advanced method which is listed in official GCP docs https://cloud.google.com/container-optimized-os/docs/how-to/run-container-instance#accessing_private_google_container_registry ,again when running docker pull (without sudo) - not found: does not exist or no pull access (docker pull command is copied from the image ,so as to illuminate chance of typo mistake)
I also tried running docker-credential-gcr gcr-login and then run docker pull (without sudo) ,also without any success.
@jonjohnsonjr - before opening the issue ,I found this one and tried to execute the steps ,but again without any success.
When running in a VM, docker-credential-gcr
will use the credentials associated with the instance's service account (usually {project number}-compute@developer.gserviceaccount.com
. This service account needs to be granted the Storage Object Viewer role on the GCS bucket where images are hosted: https://cloud.google.com/container-registry/docs/access-control
Additionally, the VM needs to grant the service account at least Read Only for the Storage Cloud API access scope: https://cloud.google.com/compute/docs/access/create-enable-service-accounts-for-instances#changeserviceaccountandscopes
Optionally, you could also configure the credential helper to use the credentials created during docker-credential-gcr gcr-login
using the following command:
docker-credential-gcr config --token-source="store"
Just tested that , now it is downloading the image. Thank you man ! Appreciate it.
@dekkagaijin should the default service account need to be granted these roles? I can only get this to work on a container optimized OS by doing a docker-credential-gcr gcr-login
first which isn't described in the COS documentation.
Hello, After execution of docker-credential-gcr configure-docker with output as follows: /home//.docker/config.json configured to use this credential helper for GCR registries.
When trying docker pull command (docker pull gcr.io/project/image) I get Error response from daemon: repository gcr.io/project/image not found: does not exist or no pull access
When I check the container registry image is ready and build.
Here is the content of config.json
{ "auths": {}, "credHelpers": { "asia.gcr.io": "gcr", "eu.gcr.io": "gcr", "gcr.io": "gcr", "staging-k8s.gcr.io": "gcr", "us.gcr.io": "gcr" } }