无法从 GCP 容器注册表中提取图像

Can't pull images from GCP Container Registry

我正在尝试从 GCP Container Registry docker pull

版本:

username@this_machine:~$ docker --version
Docker version 1.9.1, build a34a1d5
username@this_machine:~$ gcloud --version
Google Cloud SDK 319.0.0
alpha 2020.11.13
beta 2020.11.13
bq 2.0.62
core 2020.11.13
gsutil 4.55
kubectl 1.16.13
username@this_machine:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.6 LTS
Release:        14.04
Codename:       trusty
username@this_machine:~$ gcloud auth configure-docker
WARNING: Your config file at [/mnt/ext4/users/username/.docker/config.json] contains these credential helper entries:

{
  "credHelpers": {
    "gcr.io": "gcloud",
    "us.gcr.io": "gcloud",
    "eu.gcr.io": "gcloud",
    "asia.gcr.io": "gcloud",
    "staging-k8s.gcr.io": "gcloud",
    "marketplace.gcr.io": "gcloud"
  }
}
Adding credentials for all GCR repositories.
WARNING: A long list of credential helpers may cause delays running 'docker build'. We recommend passing the registry name to configure only the registry you are using.
gcloud credential helpers already registered correctly.
username@this_machine:~$ docker pull eu.gcr.io/gcp-project-1/my_docker_image
Using default tag: latest
Pulling repository eu.gcr.io/gcp-project-1/my_docker_image
Error: Status 405 trying to pull repository gcp-project-1/my_docker_image: "v1 Registry API is disabled. If you are not explicitly using the v1 Registry API, it is possible your v2 image could not be found. Verify that your image is available, or retry with `dockerd --disable-legacy-registry`. See https://cloud.google.com/container-registry/docs/support/deprecation-notices"
username@this_machine:~$ docker pull eu.gcr.io/gcp-project-1/my_docker_image:latest
Pulling repository eu.gcr.io/gcp-project-1/my_docker_image
Error: Status 405 trying to pull repository gcp-project-1/my_docker_image: "v1 Registry API is disabled. If you are not explicitly using the v1 Registry API, it is possible your v2 image could not be found. Verify that your image is available, or retry with `dockerd --disable-legacy-registry`. See https://cloud.google.com/container-registry/docs/support/deprecation-notices"

当我 运行 docker pull python 它有效。所以它可以从 docker hub 获取,而不是 gcp。

我已经完成 gcloud auth login 并尝试了具有正确权限的服务帐户(并且这一切都适用于所有其他机器)

我认为我的 cloudSDK 或 docker 安装已损坏。但我不知道,所以如果有任何想法,我将不胜感激。

您使用的 Docker 版本 1.9.1 确实过时了,它甚至不再列在 Docker page 中,我建议您先升级到较新版本的 docker 然后重试。

您可以按照this guide根据您的OS进行升级。

此外,添加标志“--disable-legacy-registry”但未明确启用或禁用它似乎是一个常见错误,该标志的正确用法是:

--disable-legacy-registry=true or --disable-legacy-registry=false

在这种情况下,您似乎需要将其设置为“true”。