简体   繁体   中英

Can't pull images from GCP Container Registry

I am trying to docker pull from GCP Container Registry.

Versions:

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"

When I run docker pull python it works. So it can get from docker hub, just not gcp.

I have done gcloud auth login and have tried service accounts with the correct permissions (and this all works on every other machine)

I think either my cloudSDK or docker installation is corrupt. But I don't know and so if any ideas, I would be grateful.

You are using Docker version 1.9.1 which is really outdated, it is not even listed in the Docker page anymore, I suggest you start by doing an upgrade to a newer version of docker and try again.

You can follow this guide to perform the upgrade based on your OS.

Also, It seems to be a common mistake to add the flag '--disable-legacy-registry' but not explicitly enable or disable it, the correct usage of the flag would be:

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

In this case, it looks like you'll need to set it to 'true'.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM