3
votes

My objective for one of my work items is to build a docker image (successfully done), and push that image to GCR (Google Container Repository). I followed various articles on google documentation but it didn't work for me.

Please refer to the below sequence to Push a docker image to GCR:

Newyork:gcloud esumit$ docker --version Docker version 19.03.4, build 9013bf5

Newyork:gcloud esumit$ gcloud auth configure-docker gcloud credential helpers already registered correctly.

Newyork:gcloud esumit$ docker push gcr.io/project-research:test-service-latest The push refers to repository [gcr.io/project-research]

79e24ced7c9c: Retrying in 1 second

9ca6d3494e40: Retrying in 1 second

86859b163231: Retrying in 2 seconds

77cae8ab23bf: Retrying in 1 second

unknown: Pushing to root-level images is disabled. See https://cloud.google.com/container-registry/docs/support/deprecation-notices

However, this works :

Newyork:gcloud esumit$ gcloud container images list Listed 0 items. Only listing images in gcr.io/project-research. Use --repository to list images in other repositories.

It says :

As of April 3rd, 2018, gcloud docker is not supported for Docker client versions above 18.03.

To authenticate requests to Container Registry for client versions above 18.03, use gcloud as a Docker credential helper. To do so, run the following command:

gcloud auth configure-docker (This I already did)

On the above sequence ended with the error: "Pushing to root-level images is disabled"

1
It worked by doing this: made images to be available in this format gcr.io/project-research/project-service:project-latestSumit Arora

1 Answers

3
votes

On referring to this link :

https://cloud.google.com/container-registry/docs/pushing-and-pulling It says tag the image this way : [HOSTNAME]/[PROJECT-ID]/[IMAGE]

docker tag [SOURCE_IMAGE] [HOSTNAME]/[PROJECT-ID]/[IMAGE]

e.g gcr.io/project-research/project-service:project-latest

And Image got pushed to GCR

LOGS

Successfully tagged gcr.io/project-research/project-service:project-latest

docker push gcr.io/project-research/project-service:project-latest The push refers to repository [gcr.io/project-research/project-service]

79e24ced7c9c: Pushed

9ca6d3494e40: Pushed

86859b163231: Pushed

77cae8ab23bf: Layer already exists

project-latest: digest: sha256:b1c6925e51dd26e3902f557c4b8dded6223635c3e415b02b5fdd47e3960758da size: 1157