Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

invalid argument "gcr.io//hello-app:v1" for "-t, --tag" flag: invalid reference format

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.

like image 436
Hazzaldo Avatar asked Dec 31 '22 20:12

Hazzaldo


2 Answers

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.

like image 165
Robert Bailey Avatar answered Jan 03 '23 09:01

Robert Bailey


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.

like image 33
DLO Avatar answered Jan 03 '23 10:01

DLO