Why does running `gcloud run deploy`, exactly according to the tutorial, give the error "image must be specified"

Question:

I’m following the Google Cloud Run quickstart for Python, but it ain’t working. I am running Python 3.7, have gcloud installed, and have all the necessary permissions on my project.

Here’s the tutorial I followed: https://cloud.google.com/run/docs/quickstarts/build-and-deploy/deploy-python-service

Here’s evidence I copied their four files into the right place locally:

******@penguin:~/helloworld$ ls -a
.  ..  Dockerfile  .dockerignore  main.py  requirements.txt

And yet here’s what I see when I run the final command, gcloud run deploy:

******@penguin:~/helloworld$ gcloud run deploy
ERROR: (gcloud.run.deploy) argument --image: Must be specified.

According to the error, I need to specify an image (presumably existing), yet the tutorial is explicit that running this command from the source directory will automatically build an image. Here’s their line: "Deploy from source automatically builds a container image from source code and deploys it."

Thanks for any tips.

Asked By: V7sharp9

||

Answers:

Ok, update your gcloud SDK. the Current version is 379, you are 62 versions behind, more than 1 year, and 1year ago, the gcloud run deploy to upload sources, build a container and deploy it on Cloud Run didn’t exist

Answered By: guillaume blaquiere

Supposing you are in the folder where the files are, you can create a docker image:

gcloud builds submit --tag gcr.io/your_project_id/image_name .

Then

gcloud run deploy service-name --image gcr.io/your_project_id/image_name
Answered By: razimbres