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 .
Discussions

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
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
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
Trying to trigger Cloud Run Job from python/django and not wait for the result
We use Cloud Tasks for this. The task can kick off the Cloud Run job. The task gives you a queue to monitor and will retry on failures etc. Python code calls that code to start the task. We use this same pattern to any longer running code and the calling code does not care how it is implemented. More on reddit.com
🌐 r/googlecloud
14
2
February 11, 2024
🌐
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
🌐
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 › GoogleCloudPlatform › cloud-run-samples
GitHub - GoogleCloudPlatform/cloud-run-samples: Samples for Cloud Run · GitHub
This repository contains sample applications used in 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 › run
Cloud Run | Google Cloud
Cloud Run can also automate how you get to production, using buildpacks to enable you to deploy directly from source—without having to install Docker on your machine. You can automate your builds and deploy your code whenever new commits are pushed to a given branch of a Git repository. Deploy a 'hello world' flask python web app on Cloud Run
🌐
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

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
    
🌐
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.
🌐
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.
🌐
Davidmuraya
davidmuraya.com › blog › python-google-cloud-functions-guide
How to Run Python Scripts in the Cloud with Google Cloud Functions
December 3, 2025 - To run it, you would execute python main.py in your terminal. This approach confirms your logic works and that you are handling environment variables correctly before you deploy. Newer (2nd gen) Cloud Functions are built on top of Cloud Run.
🌐
GitHub
github.com › GoogleCloudPlatform › getting-started-python
GitHub - GoogleCloudPlatform/getting-started-python: Code samples for using Python on Google Cloud Platform · GitHub
This repository is the complete sample code for the Python Getting Started on Google Cloud Platform tutorials. Please refer to the tutorials for instructions on configuring, running, and deploying these samples.
Starred by 817 users
Forked by 575 users
Languages   Python 53.7% | Shell 29.7% | HTML 13.5% | Dockerfile 2.2% | Makefile 0.9%
🌐
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 ...
🌐
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 Cloud
cloud.google.com › python › getting started with python on compute engine
Getting started with Python on Compute Engine | Google Cloud Documentation
From Cloud Shell, you can deploy to a single Compute Engine instance virtual machine (VM) which runs your app. You need a way to instruct your instance to download and run your code. An instance can have a startup script that runs whenever the instance is started or restarted. # Install or update needed software apt-get update apt-get install -yq git supervisor python python-pip python3-distutils pip install --upgrade pip virtualenv # Fetch source code export HOME=/root git clone https://github.com/GoogleCloudPlatform/getting-started-python.git /opt/app # Install Cloud Ops Agent sudo bash /opt