I'm following this tutorial: https://cloud.google.com/kubernetes-engine/docs/tutorials/hello-app for Google Cloud Platform. I'm using the Google Cloud Shell command line. When I got to the step: To build the container image of this application and tag it for uploading, run the following command:
docker build -t gcr.io/${PROJECT_ID}/hello-app:v1 .
I get an error:
invalid argument "gcr.io//hello-app:v1" for "-t, --tag" flag: invalid reference format
Bear in mind I already have 3 instances cluster (created from Kubernetes Engine) and one VM instance created on its own, existing in my VM instances, created from previous tutorials. Not sure if this has anything to do with the error. Thanks in advance.
Your tutorial link doesn't work (it's a link to a GCP dashboard, not a tutorial), but presumably there was a step where you were supposed to set the PROJECT_ID
variable, which you skipped. The error message shows nothing between the two slashes where ${PROJECT_ID}
appears in your command.
I also got the same error when running
docker build -t gcr.io/${PROJECT_ID}/hello-app:v1 .
but changing it to (my PROJECT_ID is say deepworld123)
docker build -t gcr.io/deepworld123/hello-app:v1 .
fixed it for me. Even though i did set PROJECT_ID=deepworld123.
You missed setting PROJECT_ID
. In the the "Before you begin" section of the tutorial you linked to it has you run
gcloud config set project [PROJECT_ID]
and then in Step 1 you run
export PROJECT_ID="$(gcloud config get-value project -q)"
After those two commands you should have the shell variable set correctly.