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
