liveBook · Manning

Cloud Run service

As explained in Learn Docker in a Month of Lunches, Second Edition

A Cloud Run service is a managed container workload that receives network requests and serves traffic through a public endpoint.

A Cloud Run service runs a container that receives network requests, such as a website or API, through a public endpoint. Cloud Run routes traffic only to healthy containers. section 14.4

Use a service when the container should remain available for incoming traffic:

  • Deploy a container image with gcloud run deploy. section 14.4
  • Set the listening port and choose whether unauthenticated callers may access it. section 14.4
  • Choose a Cloud Run job instead for background work that should execute and finish. section 14.4
# pull the source image:
docker pull ghcr.io/diamol2e/ch14-pi-web
# tag it with your Artifact Registry reference:
docker tag ghcr.io/diamol2e/ch14-pi-web "$REGISTRY/$PROJECT/ch14/pi-web"
# and push:
docker push "$REGISTRY/$PROJECT/ch14/pi-web"
# now deploy the service:
gcloud run deploy pi-web --image="$REGISTRY/$PROJECT/ch14/pi-web" `
 --port=80 --allow-unauthenticated --project=$PROJECT --region=$REGION
# print the details:
gcloud run services describe pi-web --project=$PROJECT --region=$REGION
# browse to the service URL to test the app

Deploys the pi-web image on port 80, permits unauthenticated access, prints service details, and tests the resulting URL. section 14.4

How Learn Docker in a Month of Lunches, Second Edition covers it

How deep it goes
Explains request routing, health checks, ports, authentication, and deployment, but does not detail service internals.
Examples
Demonstrates deploying the pi-web image on port 80, allowing unauthenticated access, and browsing to its service URL.
What it assumes
Assumes a container image has been uploaded to Artifact Registry and a Google Cloud project is configured.
What you can do after
Operate a containerized web application by deploying it with gcloud and verifying its public service URL.
How it connects
Connects containers with public endpoints, health checks, authentication, Artifact Registry, and Cloud Run jobs.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Docker in a Month of Lunches, Second Edition. The section links point to the parts of the book it draws on.