DEV Community

chauhoangminhnguyen
chauhoangminhnguyen

Posted on • Edited on • Originally published at howtodevez.blogspot.com

3 1 1 1 1

Using Google Cloud Run to Deploy Docker Image

Introduction

Google Cloud Run (GCR) makes deploying a Docker image as easy as running it locally. GCR also includes customizable configuration options for managing services, simplifying the deployment process significantly.

Google cloud run

Build Docker Image

The key step in deploying with a Docker image is successfully building that image. In this guide, we’ll use a NodeJS server Docker image created in this article. Follow the steps to build your Docker image (or use an existing one), and push it to Google Artifact Registry before proceeding.

Deploy Docker Image

To deploy a Docker image using Google Cloud Run, simply use the following command:

gcloud run deploy express-ts --image {docker image} --port {port container} --region {region id} --max-instances {number of instance} --allow-unauthenticated
Enter fullscreen mode Exit fullscreen mode
  • --image: is the link to the Docker image on Google Artifact Registry or Docker Hub
  • --port: is the container port you are exposing
  • --max-instances: is the number of instances

For example:

gcloud run deploy

After a successful deployment, the Service URL will be created, and you can access it immediately to start using the service.

gcloud deploy result

To list the available services, execute the following command:

gcloud service list

To delete a service:

delete service

See you again in the next articles!


If you found this content helpful, please visit the original article on my blog to support the author and explore more interesting content.

BlogspotBlogspotDev.toFacebookX


Some series you might find interesting:

Billboard image

Deploy and scale your apps on AWS and GCP with a world class developer experience

Coherence makes it easy to set up and maintain cloud infrastructure. Harness the extensibility, compliance and cost efficiency of the cloud.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay