我在https://cloud.google.com/container-builder/docs/quickstart-docker关注教程。我已经建立了图像&它被推送到谷歌的gcr.io注册表。
$ 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`
我错过了什么?
答案 0 :(得分:2)
您将gcloud
用作Docker credential helper:
gcloud auth configure-docker
因此,您必须使用gcloud docker来docker pull
从Docker注册表中获取映像。 gcloud docker
仍在下面使用Docker,但在移交给Docker之前,先向Docker客户端注入Container Registry凭据。
使用您的示例:
gcloud docker pull gcr.io/foo-bar-111111/quickstart-image:latest
您可能还必须使用sudo
,使用完整的命令:
sudo gcloud docker pull gcr.io/foo-bar-111111/quickstart-image:latest