Pushing root-level images to GCR disabled: error

I am trying to push a docker image to Google Container Repository (GCR) from my machine. I followed the instructions from the Google documentation but was unsuccessful.

When I ran docker --version I received the following output:

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

I ran gcloud auth configure-docker and it was successful:

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

However, when I ran docker push gcr.io/project-research:test-service-latest, I received the following output:

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

When I ran gcloud container images list I received the output that there were 0 items listed.

I noticed that the Google documentation states that gcloud docker is not supported for Docker client versions above 18.03. Since I am using version 19.03.4, I attempted to use gcloud as a Docker credential helper, as suggested in the documentation.

However, I still encountered the error “Pushing to root-level images is disabled” when attempting to push the docker image.

The issue is that pushing to root-level images is disabled. To resolve this issue, you need to tag the image with a specific registry path and then push it. You can do this by running the following commands:

docker push gcr.io/PROJECT_ID/IMAGE_NAME:TAG

Replace IMAGE_ID with the ID of the Docker image you want to push, PROJECT_ID with your Google Cloud project ID, IMAGE_NAME with the name you want to give to the Docker image, and TAG with the tag you want to give to the Docker image.