UPDATE
I've documented my problem and solution in much more detail here »


I had been trying to deploy my script as a Cloud Run Service. I should've tried deploying it as a Cloud Run Job. The difference is that cloud run services require your script to listen for a port. jobs do not.

Confusingly, you cannot deploy a cloud run job directly from Artifact Registry. You have to start from the cloud run dashboard.

Answer from Ben on Stack Overflow
🌐
Google
codelabs.developers.google.com › codelabs › cloud-run-hello-python3
Hello Cloud Run with Python | Google Codelabs
March 20, 2026 - For the list of currently supported regions, see Cloud Run (fully managed) locations. ... gcloud run deploy helloworld-python \ --source . \ --platform managed \ --region $REGION \ --allow-unauthenticated · You can define a default region with this command: gcloud config set run/region $REGION
Discussions

docker - How to run a "hello world" python script with Google Cloud Run - Stack Overflow
I'm trying to learn how to schedule python scripts with Google Cloud. After a bit of research, I've seen many people suggest Docker + Google Cloud Run + Cloud Scheduler. I've attempted to get a "hello world" example working, to no avail. More on stackoverflow.com
🌐 stackoverflow.com
Automating Python with Google Cloud
This tutorial is great. I really wanted to learn this. More on reddit.com
🌐 r/Python
30
120
March 28, 2024
How to use python cloud function to deploy a Cloud Run revision
Have you looked at Cloud Run Jobs to handle this? It should allow you to run a gcloud command. https://cloud.google.com/run/docs/create-jobs More on reddit.com
🌐 r/googlecloud
6
1
September 22, 2022
How to automate a Python script with Docker and Google Cloud Run
This is awesome! For an even lower deployment/ops overhead, did you try hooking up a cloud scheduler function to a Gen 2 Cloud Function? Is there a reason you're using Cloud Run specifically? (CF Gen 2 runs on CR) More on reddit.com
🌐 r/googlecloud
3
5
December 15, 2022
🌐
GitHub
github.com › GoogleCloudPlatform › cloud-run-samples
GitHub - GoogleCloudPlatform/cloud-run-samples: Samples for Cloud Run · GitHub
Samples by Language: nodejs, golang, python, java, php, ruby · The Cloud Run Button makes your Cloud Run service deployable with the push of a button. (It will open a Cloud Shell window.) Sample · Cloud Run Button · Details from the Cloud Run Documentation ·
Starred by 300 users
Forked by 112 users
Languages   Shell 42.3% | Dockerfile 22.8% | Python 19.3% | Go 15.6%
🌐
Google Cloud
cloud.google.com › application hosting › cloud run › quickstart: build and create a python job in cloud run
Quickstart: build and create a Python job in Cloud Run | Google Cloud
This quickstart uses deploy from source, which builds the container, uploads it to Artifact Registry, and deploys the job to Cloud Run: gcloud run jobs deploy job-quickstart \ --source .
🌐
Medium
medium.com › google-cloud › cloud-run-job-with-a-python-module-f072f49b9849
Cloud Run job Python Google Cloud | Google Cloud - Community
September 10, 2024 - For this example, we preferred to have the Dockerfile inside the job folder instead of putting it at the root of the project. We favor this approach because, if we were managing several Cloud Run jobs, we would organize each job in its own directory, with a dedicated Dockerfile inside. FROM python:3.10-slim ENV PYTHONUNBUFFERED True COPY team_league/job/requirements.txt ./ RUN pip install -r requirements.txt ENV APP_HOME /app WORKDIR $APP_HOME COPY setup.py $APP_HOME/setup.py COPY team_league $APP_HOME/team_league CMD ["/usr/local/bin/python3", "-m", "team_league.job.main"]
🌐
GitHub
github.com › grpc-ecosystem › grpc-cloud-run-example › blob › master › python › README.md
grpc-cloud-run-example/python/README.md at master · grpc-ecosystem/grpc-cloud-run-example
\ --python_out=. \ --grpc_python_out=. \ calculator.proto · Finally, we set our container up to run the server by default. ... Now we can build our image. In order to deploy to Cloud Run, we'll be pushing to the gcr.io container registry, so we'll tag it accordingly.
Author   grpc-ecosystem
Find elsewhere
🌐
PyPI
pypi.org › project › google-cloud-run
google-cloud-run · PyPI
python3 -m venv <your-env> source <your-env>/bin/activate pip install google-cloud-run
      » pip install google-cloud-run
    
🌐
GitHub
github.com › GoogleCloudPlatform › cloud-run-microservice-template-python
GitHub - GoogleCloudPlatform/cloud-run-microservice-template-python
A template repository for a Cloud Run microservice, written in Python
Starred by 107 users
Forked by 74 users
Languages   Python 78.7% | Shell 12.1% | Dockerfile 8.8% | Procfile 0.4% | Python 78.7% | Shell 12.1% | Dockerfile 8.8% | Procfile 0.4%
🌐
Google Cloud
cloud.google.com › cloud run › quickstarts
Quickstarts | Cloud Run | Google Cloud Documentation
Create a simple Cloud Run job in Python, package it into a container image, and deploy to Cloud Run.
🌐
GitHub
github.com › GoogleCloudPlatform › cloud-run-samples › blob › main › README.md
cloud-run-samples/README.md at main · GoogleCloudPlatform/cloud-run-samples
Samples by Language: nodejs, golang, python, java, php, ruby · The Cloud Run Button makes your Cloud Run service deployable with the push of a button. (It will open a Cloud Shell window.) Sample · Cloud Run Button · Details from the Cloud Run Documentation ·
Author   GoogleCloudPlatform
🌐
GeeksforGeeks
geeksforgeeks.org › cloud computing › google-cloud-run-working-with-python
Google Cloud Run - Working with Python - GeeksforGeeks
January 13, 2021 - This is where you set your Python runtime. The COPY command adds files from your Docker client's current directory as below: ... The RUN command installs Flask, gunicorn, and currency converter dependencies for the service. ... And finally, CMD is a command to start the application inside the container and bind it to a port. ... The app: app at the end means import our app from the app.py file. One of the advantages of Cloud Run is that you can run any Python version you want as long as there is a base Docker image available for it.
🌐
C2cglobal
c2cglobal.com › articles › how-to-run-python-on-google-cloud-1356
How to Run Python on Google Cloud
It's an integral step to ensure the Google Cloud run Python script runs efficiently in Kubernetes and the last leg of the migration process. To deploy a YML file to Kubernetes, run the following command: $ kubectl create -f example.yml You can verify that your files deployed by running the following command: $ kubectl get services
🌐
Scipress
scipress.io › post › FA9QzMVdssdMt4IYq0yX › Automating-Python-with-Google-Cloud-Run
Automating Python with Google Cloud Run - Scipress
June 18, 2024 - Running this command in your local terminal should produce some output like this 👇 · This command is equivalent to running `gcloud builds submit --pack image=[IMAGE] .` and `gcloud run jobs deploy my-job --image [IMAGE]` Building using ...
🌐
Apache Airflow
airflow.apache.org › docs › apache-airflow-providers-google › stable › operators › cloud › cloud_run.html
Google Cloud Run Operators — apache-airflow-providers-google Documentation
def _create_job_dict() -> dict: """ Create a Cloud Run job configuration with a Python dict. As a minimum the configuration must contain a container image name in its template.
🌐
Google Cloud
cloud.google.com › cloud run › the python runtime
The Python runtime | Cloud Run | Google Cloud Documentation
In the Google Cloud console, go to the Cloud Run page: ... Click Write a function. In the Runtime list, select a Python runtime version.
🌐
Google
codelabs.developers.google.com › codelabs › cloud-run › cloud-run-hello-fastapi
Hello Cloud Run with Python (FastAPI) | Google Codelabs
Under the hood, to deploy your application, Cloud Run pairs with the container ecosystem: Cloud Build automatically builds a container image from your source code and pushes it to Artifact Registry. Artifact Registry manages your container image. Now, you're ready to start working and write your application... In this step, you'll build a "Hello World" FastAPI Python application responding to HTTP requests.
🌐
Reddit
reddit.com › r/python › automating python with google cloud
r/Python on Reddit: Automating Python with Google Cloud
March 28, 2024 -

I just published a tutorial series on how to automate a Python script in Google Cloud using Cloud Functions and/or Cloud Run. Feedback would be great. Thanks!

  • Automating Python with Google Cloud

    • Automating Python with Google Cloud Functions

    • Automating Python with Google Cloud Run