Search code examples
dockercontainersgoogle-kubernetes-enginedocker-registrydocker-push

Docker push in Kubernetes container registry failing


The docker build was clearly successful as the docker image exists, but docker push keeps failing:

enter image description here

Why? And how do I fix it?

I also tried replacing the project name with the project ID from the dashboard as shown in the screenshot of the terminal, but to no avail.

I have already done gcloud auth configure-docker before.


EDIT: After tagging the docker image appropriately, and then trying to push it, I still get the same error:

enter image description here

Showing two runs, the latter with project ID in the name. It gives error too.


Solution

  • Ok, I got it working now. The build command needs to be changed, the guide I was following seems to be outdated now.

    So in the guide I was following, the gcr.io was given in build command itself like so:

    docker build -t gcr.io/pycaret-kubernetes-demo/insurance-app:v1 .
    

    But now, the solution is to build it normally, without the gcr.io, like so:

    docker build -t insurance-app .
    

    And then, like the previous answerer says, we need to tag it appropriately as documented in Google's official guide:

    docker tag insurance-app gcr.io/endless-ability-365318/insurance-pycaret-demo:v1
    

    The insurance-pycaret-demo:v1 part is any name you choose to give the new image.

    After that, docker push gcr.io/endless-ability-365318/insurance-pycaret-demo:v1 works.