0

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.

Kristada673
  • 3,512
  • 6
  • 39
  • 93

2 Answers2

0

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.

YJR
  • 1,099
  • 3
  • 13
  • I ran `docker image tag image_id gcr.io/endless-ability-365318/insurance_app:v1`. but got the error `Error response from daemon: No such image: image_id:latest` – Kristada673 Oct 12 '22 at 20:03
  • ok, ran `docker image tag image_id gcr.io/pycaret-kubernetes-demo/insurance-app:v1`, got the same exact error: `Error response from daemon: No such image: image_id:latest` – Kristada673 Oct 12 '22 at 20:05
  • I've added a screenshot in the question under 'EDIT', showing the error I now get after following your suggestions. – Kristada673 Oct 12 '22 at 20:15
  • If it succesfully get tagged you can see that name in images. – YJR Oct 12 '22 at 20:32
0

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.

Kristada673
  • 3,512
  • 6
  • 39
  • 93