---
title: "From On-Prem to the Cloud - A GCP Docker Container Deployment Guide Using Artifact Registry and Cloud Run"
description: "A step-by-step guide on how to push a Docker image to GCP Artifact Registry and then deploy it as a container via Google Cloud Run, including both manual and CLI methods."
canonical_url: "https://blog.markkulab.net/en/post/on-prem-to-cloud-gcp-docker-deployment-artifact-registry-cloud-run"
author: "Mark Ku"
author_url: "https://blog.markkulab.net/en/author/mark-ku"
site: "Mark Ku's Tech Notes"
date_published: "2024-11-12 01:01:35 +0800"
category: "Cloud"
tags: ["gcp", "google cloud", "docker", "artifact registry", "cloud run", "devops", "container"]
language: "en"
license: "CC BY 4.0"
license_url: "https://creativecommons.org/licenses/by/4.0/"
attribution: "when reusing or quoting, credit the author and link back to the original"
---

# From On-Prem to the Cloud - A GCP Docker Container Deployment Guide Using Artifact Registry and Cloud Run

### Introduction
I used to be particularly interested in self-hosting servers, with most of my experience concentrated in on-premises environments. I've worked with everything from self-hosting Windows Server and Linux Server to using Hyper-V and vSphere, and have dabbled in technologies from Windows Docker Containers to Linux Docker Containers. With the development of container technology and the increasing convenience of the cloud, more and more companies are adopting cloud servers, which has sparked my interest in further exploring the possibilities of cloud deployment.

### On-Premises vs. Cloud Container Deployment Flow

*   **On-Premises Deployment Flow**  
    Docker Build Image → Push Image to Private Registry → Docker Run

*   **Cloud Deployment Flow**  
    Docker Build Image → Push Image to Google Artifact Registry → Google Cloud Run

### Environment Setup
- Operating System: Windows 11, with Docker Desktop installed locally.
- A containerizable project with a pre-existing Dockerfile.
- GCP Project ID: gcr-my-project01 [Link to get your Project ID](https://console.cloud.google.com/welcome/new?cloudshell=true)
- Google Artifact Registry host location: asia-east1-docker.pkg.dev (Found in Artifact Registry > Check your Registry > Setup Instructions)

### Installing the Google Cloud CLI

1. Download and install the [Google Cloud CLI](https://cloud.google.com/sdk/docs/install-sdk)

```powershell
(New-Object Net.WebClient).DownloadFile("https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe", "$env:Temp\GoogleCloudSDKInstaller.exe")
& $env:Temp\GoogleCloudSDKInstaller.exe
```
2. During the Windows installation, an installation window will pop up. Just follow the prompts and click "Next" all the way through.
3. After installation, you will be asked if you want to log in and select a Google project (of course, you can also log in via the command line, e.g., `gcloud auth login`).
![gcp cli sign](https://blog.markkulab.net/content/markku/posts/on-prem-to-cloud-gcp-docker-deployment-artifact-registry-cloud-run/images/gcp-cli-sign.png)

```
gcloud auth login
gcloud projects list
gcloud config set project PROJECT_ID
```

### Creating an Artifact Registry

Go to Artifact Registry and get the URL for your registry.

1. Create a repository
![Create repository](https://blog.markkulab.net/content/markku/posts/on-prem-to-cloud-gcp-docker-deployment-artifact-registry-cloud-run/images/create-artifact-registry.png)

2. Make minor adjustments to the default settings > Create
![artifact registry settings](https://blog.markkulab.net/content/markku/posts/on-prem-to-cloud-gcp-docker-deployment-artifact-registry-cloud-run/images/artifact-registry-settings.png)

3. Select the created registry > Setup instructions > Copy the configuration command
![get local's set up command](https://blog.markkulab.net/content/markku/posts/on-prem-to-cloud-gcp-docker-deployment-artifact-registry-cloud-run/images/get-local-registry-set-up-command.png)
**Note:** Windows users should remove `\` to make the command a single line.

4. Configure Google Artifact Registry on your local machine:

```powershell
gcloud auth configure-docker asia-east1-docker.pkg.dev
```
   
![Screen after setup](https://blog.markkulab.net/content/markku/posts/on-prem-to-cloud-gcp-docker-deployment-artifact-registry-cloud-run/images/already-set-up-artifact-registry.png)

### Building and Verifying the Docker Image
1. First, use the command line to navigate to your containerizable project, which should already have a Dockerfile.
2. Use the following command to build the Docker image:

```powerhsell
docker build -t asia-east1-docker.pkg.dev/gcr-my-project01/my-registry/ec:v2 .
```

3. Run the image to test it locally:

```powerhsell
docker run -d -p 8888:80 asia-east1-docker.pkg.dev/gcr-my-project01/my-registry/ec:v2
```
4. Visit localhost:8888 to test the container service and check for any issues.
![local container testing](https://blog.markkulab.net/content/markku/posts/on-prem-to-cloud-gcp-docker-deployment-artifact-registry-cloud-run/images/local-container-testing.png)

### Pushing the Image to Artifact Registry

```powerhsell
docker push asia-east1-docker.pkg.dev/gcr-my-project01/my-registry/ec:v2
```
At this point, you should be able to see the Docker image you just pushed in your registry.
![check registry](https://blog.markkulab.net/content/markku/posts/on-prem-to-cloud-gcp-docker-deployment-artifact-registry-cloud-run/images/check-registry.png)

### Deploying to Google Cloud Run
Google Cloud Run supports both manual deployment via the web UI and deployment using command-line scripts.
#### Manual Deployment from the Web UI

1. In Cloud Run, select "+Deploy Container".
![manual deploy google cloud run step 1](https://blog.markkulab.net/content/markku/posts/on-prem-to-cloud-gcp-docker-deployment-artifact-registry-cloud-run/images/manual-deploy-google-cloud-run-step1.png)

2. Follow the on-screen instructions to complete the setup.
![manual deploy google cloud run step 2](https://blog.markkulab.net/content/markku/posts/on-prem-to-cloud-gcp-docker-deployment-artifact-registry-cloud-run/images/manual-deploy-google-cloud-run-step2.png)

3. Go into Cloud Run, configure parameters like Container(s), Volumes, Networking, and Security, and set the Container port to 80.
![manual deploy google cloud run step 3](https://blog.markkulab.net/content/markku/posts/on-prem-to-cloud-gcp-docker-deployment-artifact-registry-cloud-run/images/manual-deploy-google-cloud-run-step3.png)

#### Alternatively, Deploy to Cloud Run Using a Script

```bash
gcloud run deploy my-service --image=asia-east1-docker.pkg.dev/gcr-my-project01/my-registry/ec:v2 --platform managed --allow-unauthenticated --region=asia-east1 --port=80
```

* Additional info - [Gcloud run deploy parameter documentation](https://cloud.google.com/sdk/gcloud/reference/run/deploy)

![Automated deployment - screen after execution](https://blog.markkulab.net/content/markku/posts/on-prem-to-cloud-gcp-docker-deployment-artifact-registry-cloud-run/images/auto-deploy-google-cloud-run-step1.png)
Now, visit this URL to check your container application. You can also see the status of this container service in Google Cloud Run.

## Conclusion
After using the GCP CLI, I found that its operation is quite similar to on-premises commands, which significantly lowered the learning curve. For small and medium-sized enterprises, a cloud tool like this is particularly attractive. It not only eliminates the cost of purchasing physical servers but also removes the hassle of software updates. For a smaller company where the daily maintenance workload isn't enough to justify a full-time network administrator, GCP's flexible plans allow us to scale resources up or down as needed, enabling more agile use of our IT budget.

## Addendum - Updating an Image by Redeploying the Service
### Method 1: Update the Image Using the Google Cloud Console Website
1. Go to the [Google Cloud Console](https://console.cloud.google.com/).
2. Navigate to **Cloud Run**.
3. Click on the service you want to update.
4. Click **EDIT AND DEPLOY NEW REVISION** or **Deploy New Revision**.
5. In the **Container image URL** field, enter the new container image (e.g., `gcr.io/<project-id>/<image-name>:<tag>`).
6. Configure other settings (if needed), then click **Deploy**.

### Method 2: Update the Image Using the `gcloud` CLI
If you are using the command-line tool, you can use the `gcloud run deploy` command to update the image:

```bash
gcloud run deploy <SERVICE_NAME> \
  --image gcr.io/<PROJECT_ID>/<ARTIFACT_REGISTRY_URL>/<IMAGE_NAME>:<TAG> \
  --region <REGION>
```

## References

- [Binding a Custom Domain to GCP Cloud Run](https://medium.com/@yuijzeon/%E9%9A%A8%E6%89%8B%E8%A8%98-gcp-cloud-run-%E6%9C%8D%E5%8B%99%E7%B6%81%E5%AE%9A%E5%88%B0%E8%87%AA%E5%B7%B1%E7%9A%84%E7%B6%B2%E5%9D%80-f316028a0c0e)
- [Upgrading Your Cloud Run CI/CD with Jenkins](https://manel-lemin.medium.com/upgrading-your-cloud-run-ci-cd-with-jenkins-92a3717e9f1c)

---

## About this article and its author

Originally published on [Mark Ku's Tech Notes](https://blog.markkulab.net/en/post/on-prem-to-cloud-gcp-docker-deployment-artifact-registry-cloud-run)

License: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) — when reusing or quoting, credit the author and link back to the original

### About the author

**[Mark Ku](https://blog.markkulab.net/en/author/mark-ku)** — Software Solution Provider

- 10+ years senior software engineer, now an AI Builder
- Focused on large-platform architecture — North-American e-commerce, AI SaaS subscription billing
- Combining AI Agents and automation to build evolvable product foundations

### Free tools built by the author

All of these are free to use:

- [Free PDF Sign Tool](https://blog.markkulab.net/en/tools/pdf-sign): Online PDF sign tool — draw, type, or upload a signature, then drag, resize, and download. Everything runs in your browser; nothing is uploaded.
- [VS Code Refactory](https://blog.markkulab.net/en/tools/refactory): Refactory is a VS Code refactoring extension: 34 actions plus a 37-rule code-smell inspection layer with a Code Health dashboard, across 18 languages, backed by 534 tests. It learns your repo's conventions: where interfaces live, where DI is registered, whether 'use client' belongs. It ranks files by git churn × complexity so you know what to fix first, and hands any smell to the Claude Code already on your machine. Free to use, and your source never leaves your computer.
- [DB-Kit Database Manager](https://blog.markkulab.net/en/tools/db-kit): DB-Kit is a lightweight, cross-platform database manager built with Tauri + Rust + React. Manage MySQL, MariaDB, PostgreSQL, SQL Server, Oracle, SQLite, MongoDB, Redis, Kafka, Elasticsearch and RabbitMQ from one consistent interface: passwords encrypted in the OS keychain, SSH tunnels, full CRUD, a visual query builder, stacked multi-statement result sets, cross-connection data transfer and compare/sync, Excel / CSV import & export, visualized execution plans, ER diagrams, scheduled backups, SQL stress testing with p50–p99 latency percentiles, a 15-rule SQL review engine, Kafka message browsing with monitoring & alerts, a bilingual UI (Traditional Chinese / English), a built-in AI assistant (natural-language SQL, AI review and tuning advice) and the dbk CLI. Free and open source (MIT), with installers for Windows, macOS and Linux.
- [VS Code Super Mermaid](https://blog.markkulab.net/en/tools/super-mermaid): Super Mermaid is a VS Code extension for beautiful Mermaid diagrams out of the box: auto-colored live preview, mouse pan & zoom, high-res PNG / SVG export, 21 templates and multiple themes. Free and open source (MIT).
- [React Super Mermaid](https://blog.markkulab.net/en/tools/react-super-mermaid): react-super-mermaid is an open-source React component library: render beautiful Mermaid diagrams with a single <MermaidViewer>, with built-in colorful / sketch themes, pan & zoom, in-diagram search, and high-res SVG / PNG export. Lightweight, SSR-safe, fully typed. Free and open source (MIT).
- [Jira / Confluence Super Mermaid](https://blog.markkulab.net/en/tools/jira-super-mermaid): An Atlassian Forge app: write Mermaid syntax directly inside a Jira issue or a Confluence page and get flowcharts, sequence diagrams, state machines and Gantt charts. 11 diagram types, SVG / PNG export, light and dark themes, full CJK support. Runs on Atlassian: your diagrams live in your own site and the app calls no third-party service. Free, coming soon to the Atlassian Marketplace.
- [Mermaid Live Preview](https://blog.markkulab.net/en/tools/mermaid-preview): Write Mermaid in your browser, see it render instantly, and share the whole diagram as a single link. No sign-up, nothing uploaded to a server, and mermaid.live share links work as-is.
- [React Intl Phone Number](https://blog.markkulab.net/en/tools/react-intl-phone-number): react-intl-phone-number is an open-source React component: framework-agnostic and antd-free, with E.164 in/out, a searchable flag / country-code dropdown, configurable validation levels (strict / mobile-strict / loose), themeable CSS, and i18n — phone logic powered by google-libphonenumber. Lightweight and fully typed. Free and open source (MIT).
- [Uptime Kuma Cluster](https://blog.markkulab.net/en/tools/uptime-kuma-cluster): Turn single-node Uptime Kuma into a highly available cluster: OpenResty + Lua smart load balancing, shared MariaDB state, health checks and automatic failover, plus cluster-management REST APIs. One Docker Compose command to start. Free and open source (MIT).
- [Special Education](https://blog.markkulab.net/en/education): Learning materials crafted for special education students

### Daily podcasts

- [Mark's Tech Insights — Daily AI News](https://blog.markkulab.net/en/category/tech-news): Daily curated AI and tech trends. Catch the latest developments via audio summaries — covering AI applications, software architecture, DevOps, and engineering practice. — RSS: https://blog.markkulab.net/feed.xml
- [AI股市蝦聊](https://blog.markkulab.net/en/category/ai-stock-chat): Every trading day, an AI-analyzed take on the Taiwan stock market, delivered as a two-host conversation covering the session and the next-day outlook. — RSS: https://blog.markkulab.net/ai-stock-chat/feed.xml
- [開源好物週報](https://blog.markkulab.net/en/category/open-source-weekly): A weekly two-host pick of free open-source tools surfaced from real Hacker News, GitHub, and Reddit buzz — what pain they solve and the fastest way to get started. — RSS: https://blog.markkulab.net/open-source-weekly/feed.xml

### Newsletter

[Subscribe to the newsletter](https://blog.markkulab.net/en/subscribe) — Be the first to know about new posts. No spam, unsubscribe anytime.
