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
docs.cloud.google.com › cloud run › quickstart: build and create a python job in cloud run
Quickstart: build and create a Python job in Cloud Run | Google Cloud Documentation
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 .
🌐
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
What's the best way to run python scripts on the cloud to process Google Sheets data?
There’s probably 100 ways to do this, but I’ve done something similar using google cloud platform services. I’d use cloud functions to run the script. Use gspread to interact with your sheet. Not sure what the best option is to save the output to google drive, but there are some google client libraries that can probably assist with that. You’ll need to sort out Auth and permissions, which can be a pain but is doable. You can trigger the cloud function on a schedule, or manually, or whatever other triggering mechanism you want to use. Depending on what you are doing, you’d probably stay in the free tier. More on reddit.com
🌐 r/pythontips
9
3
March 16, 2024
cheapest way to run python code 24/7 on cloud?
Python Anywhere can host python code for free given that you don't have a lot of traffic. I've only used it once for hosting a webapp but worked well, it could possibly work for your use case More on reddit.com
🌐 r/learnpython
26
69
June 3, 2024
🌐
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 113 users
Languages   Shell 42.3% | Dockerfile 22.8% | Python 19.3% | Go 15.6%
🌐
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"]
🌐
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
    
Find elsewhere
🌐
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%
🌐
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
🌐
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
🌐
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.
🌐
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

🌐
Davidmuraya
davidmuraya.com › blog › python-google-cloud-functions-guide
How to Run Python Scripts in the Cloud with Google Cloud Functions
December 3, 2025 - You should always test your function locally before deploying. The if __name__ == "__main__": block allows you to run the script directly from your terminal. To run it, you would execute python main.py in your terminal.
🌐
Medium
001-dharmendra.medium.com › getting-started-with-google-cloud-run-deploying-python-scripts-609838f82a8b
Getting Started with Google Cloud Run: Deploying Python Scripts | by dharmendra mishra | Medium
October 16, 2023 - This Dockerfile uses an official Python 3.9 image, sets up the working directory, copies the Python script and requirements file, installs dependencies, exposes port 8080, and runs the Python script. ... Before deploying the container image, you need to build and push it to a container registry. Google Cloud provides a Container Registry service, but you can also use other container registries like Docker Hub.
🌐
Google
docs.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.
🌐
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.