skip to Main Content

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.

2

Answers


  1. Chosen as BEST ANSWER

    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.


  2. First change your image name to the gcr.io/<your_project_id>/insurance_app:v1.
    For that use following command.

    docker image tag <image_id> gcr.io/<your_project_id>/insurance_app:v1
    

    Then use again following command

    the docker push gcr.io/<your_project_id>/insurance_app:v1
    

    Because before push to the docker google cloud docker registry you have to format the image name using registry name and project id.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search