How to use Google Cloud Run for containerized apps

· Category: Cloud Computing

Short answer

Cloud Run deploys containers that automatically scale to zero and handle HTTP requests without managing servers.

Steps

  1. Build and push a container to Artifact Registry or Docker Hub.
  2. Deploy:
gcloud run deploy my-service --image gcr.io/project/my-image --platform managed
  1. Set concurrency, memory, and CPU limits.
  2. Map a custom domain and configure HTTPS.

Tips

  • Cloud Run supports HTTP/2 and WebSockets.
  • Use Cloud Tasks or Pub/Sub for asynchronous processing.
  • Minimum instances reduce cold starts for latency-sensitive apps.

Common issues

  • Container must listen on the PORT environment variable.
  • Startup time affects cold start latency; keep images small.