Welcome to the first post in 2020!
I hope you had a good start and you are ready for some new content on the blog.
In this blog post I will show you what to do in case you can’t push Docker image to Google Cloud Platform Container Registry.
As I am progressing through Acloud Guru Course Google Kubernetes Engine (GKE): Beginner to Pro I found some strange issue.
At the beginning of the course I’ve created a Google Cloud Container Registry by executing following command docker tag myapp gcr.io/cka-fwc/myapp
followed by docker push myapp gcr.io/cka-fwc/myapp
. It worked like a charm.
After that I deleted my project and I created new one with the same name of the project. ID of course was different but wasn’t that important back then.
I fired up GCP console and I tried to push docker image to container registry.
I had errors such as:
docker push myapp gcr.io/cka-fwc/myapp
The push refers to repository [gcr.io/cka-fwc/myapp]
fdc9037729ff: Preparing
fcf9753e270b: Preparing
83f36823b9c8: Preparing
083f4cf591b1: Preparing
937293c13d41: Preparing
789630e55637: Waiting
3f4c8c89729b: Waiting
5c813a85f7f0: Waiting
bdca38f94ff0: Waiting
faac394a1ad3: Waiting
ce8168f12337: Waiting
denied: Project cka-fwc has been deleted.
I couldn’t figure out what the issue might be. After a while I’ve tried the following commands:
docker tag myapp gcr.io/cka-fwc-267314/myapp
docker push myapp gcr.io/cka-fwc-267314/myapp
It worked like a charm!
The push refers to repository [gcr.io/cka-fwc-267314/myapp]
fdc9037729ff: Pushed
fcf9753e270b: Pushed
83f36823b9c8: Pushed
083f4cf591b1: Pushed
937293c13d41: Pushed
789630e55637: Layer already exists
3f4c8c89729b: Layer already exists
5c813a85f7f0: Layer already exists
bdca38f94ff0: Layer already exists
faac394a1ad3: Layer already exists
ce8168f12337: Layer already exists
latest: digest: sha256:5b1fde021a88afe2e97bc9c7640166ec6f64539832a1d471ae3cd19f8057bfd5 size: 2636
So instead of using GCP project name I used it’s ID and it worked. I hope you will find this useful.