Reputation: 8443
I am following the tutorial at https://cloud.google.com/container-builder/docs/quickstart-docker . I've built the image & it is pushed to Google's gcr.io registry.
$ gcloud auth configure-docker
gcloud credential helpers already registered correctly.
$ docker run --init gcr.io/foo-bar-111111/quickstart-image
Unable to find image 'gcr.io/foo-bar-111111/quickstart-image:latest' locally
docker: Error response from daemon: 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.
See 'docker run --help'.
$ docker-credential-gcr configure-docker
/home/wonderwoman/.docker/config.json configured to use this credential helper for GCR registries
$ docker run --init gcr.io/foo-bar-111111/quickstart-image
Unable to find image 'gcr.io/foo-bar-111111/quickstart-image:latest' locally
docker: Error response from daemon: 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.
See 'docker run --help'.
$ docker pull gcr.io/foo-bar-111111/quickstart-image:latest
Please login prior to pull:
error getting credentials - err: exit status 1, out: `docker-credential-gcr/helper: could not retrieve GCR's access token: credentials not found in native keychain`
What have I missed ?
Upvotes: 0
Views: 714
Reputation: 10613
You're using gcloud
as a Docker credential helper:
gcloud auth configure-docker
So you must use gcloud docker to docker pull
your image from the docker registry. gcloud docker
still uses Docker underneath, but injects the Docker client with Container Registry credentials before handing off to Docker.
Using your example:
gcloud docker pull gcr.io/foo-bar-111111/quickstart-image:latest
You will likely have to use sudo
too, making the full command:
sudo gcloud docker pull gcr.io/foo-bar-111111/quickstart-image:latest
Upvotes: 2