【アップデート】Cloud Run で GitHub Container Registry(GHCR)のパブリックコンテナイメージを直接デプロイする機能がリリースされました

【アップデート】Cloud Run で GitHub Container Registry(GHCR)のパブリックコンテナイメージを直接デプロイする機能がリリースされました

Google Cloud の Cloud Run が GitHub Container Registry(GHCR)のパブリックコンテナイメージを直接デプロイする機能が GA となりました。追加手順なしで ghcr.io のイメージを直接デプロイできるようになります。
2026.07.17

はじめに

こんにちは。
クラウド事業本部コンサルティング部の渡邉です。

2026年7月14日、Cloud Run で GitHub Container Registry(GHCR)のパブリックコンテナイメージを直接デプロイする機能が General Availability(GA)となりました。

https://docs.cloud.google.com/run/docs/release-notes#July_14_2026

https://docs.cloud.google.com/run/docs/deploying?hl=ja#images

これまで Cloud Run にデプロイできるコンテナイメージは、Artifact Registry または Docker Hub に限定されていました。今回の GA により、Github Container Registry (ghcr.io) でホストされているパブリックイメージを追加の手順なしで Cloud Run に直接デプロイできるようになりました。OSS のアプリケーションやツールを素早く試したいケース、GitHub Actions と組み合わせたデプロイフローを構築したいケースで特に役立ちます。

本記事では、Cloud Run の GitHub Container Registry(GHCR) サポートの概要と、実際に試してみた内容をご紹介します。

Cloud Run がサポートするコンテナレジストリ

今回の GA により、Cloud Run が直接サポートするレジストリは以下の3種類になりました。

レジストリ 直接サポート 対象イメージ キャッシュ
Artifact Registry パブリック・プライベート なし(Google 管理)
Docker Hub パブリックのみ(推奨イメージ) 最大1時間
GitHub Container Registry(ghcr.io) パブリックのみ 最大1時間

イメージのインポート動作

Cloud Run はデプロイ時にコンテナイメージをインポートします。インスタンスの起動ごとに外部レジストリへアクセスするのではなく、デプロイ時点のイメージが Cloud Run 側に保持されます。そのため、外部レジストリが一時的に利用不可になっても、デプロイ済みのリビジョンは影響を受けません。

GHCR および Docker Hub のイメージは最大1時間キャッシュされます。

制限事項

GitHub Container Registry(GHCR)でホストされているパブリックイメージをCloud Run へ直接デプロイさせるときの制限事項です。

項目 制限
対象イメージ パブリックイメージのみ
イメージレイヤーの最大サイズ 9.9 GB(Docker Hub 経由または Artifact Registry リモートリポジトリ経由の場合)
可用性 Google は高可用性のために Artifact Registry リモートリポジトリ経由を推奨

実際に試してみる

前提条件

  • Google Cloud プロジェクトが作成済みであること
  • Cloud Run API が有効になっていること
  • Cloud Run Developer ロール(roles/run.developer)と Service Account User ロール(roles/iam.serviceAccountUser)が付与されていること
  • gcloud CLI がインストール・認証済みであること

ステップ0: 環境変数を設定する

以降のコマンドで共通して使用する変数を設定します。PROJECT_ID はご自身の Google Cloud プロジェクト ID に置き換えてください。

PROJECT_ID=your-project-id
REGION=asia-northeast1
SERVICE_NAME=nginx-ghcr-test
IMAGE=ghcr.io/nginxinc/nginx-unprivileged:latest

ステップ1: デプロイするイメージを確認する

GHCR でホストされているパブリックイメージを確認します。今回は nginxinc が GHCR に公開している Nginx 公式イメージ nginx-unprivileged を使用します。

https://github.com/nginxinc/docker-nginx-unprivileged

nginx-unprivileged はポート 8080 で起動します。Cloud Run のデフォルトポートも 8080 であるため、--port の指定なしにそのままデプロイできます。

ステップ2: Cloud Run にデプロイする

gcloud run deploy コマンドの --image フラグに GHCR の URL を直接指定します。

gcloud run deploy $SERVICE_NAME \
  --image $IMAGE \
  --region $REGION \
  --allow-unauthenticated \
  --project $PROJECT_ID

Deploying container to Cloud Run service [nginx-ghcr-test] in project [your-project-id] region [asia-northeast1]
 Deploying new service... Done.                                                                                                                                                             
 Creating Revision...                                                                                                                                                                     
 Routing traffic...                                                                                                                                                                       
 Setting IAM Policy...                                                                                                                                                                    
Done.                                                                                                                                                                                        
Service [nginx-ghcr-test] revision [nginx-ghcr-test-00001-5b8] has been deployed and is serving 100 percent of traffic.
Service URL: https://nginx-ghcr-test-xxxxxxxxxxxx.asia-northeast1.run.app

To take a quick anonymous survey, run:
  $ gcloud survey

--imageghcr.io/<owner>/<image>:<tag> の形式で指定するだけで、Artifact Registry へのコピーなどの追加手順は不要です。ウェルカムページを公開アクセスするため --allow-unauthenticated を指定します。

ステップ3: デプロイされたサービスを確認する

gcloud run services describe $SERVICE_NAME \
  --region $REGION \
  --project $PROJECT_ID

 Service nginx-ghcr-test in region asia-northeast1

URL:     https://nginx-ghcr-test-xxxxxxxxxxxx.asia-northeast1.run.app
Ingress: all
Traffic:
  100% LATEST (currently nginx-ghcr-test-00001-5b8)

Scaling: Auto (Min: 0, Max: 100)

Last updated on 2026-07-15T21:38:06.903585Z by your-account@example.com:
  Revision nginx-ghcr-test-00001-5b8
  Container None
    Image:           ghcr.io/nginxinc/nginx-unprivileged:latest
    Port:            8080
    Memory:          512Mi
    CPU:             1000m
    Startup Probe:
      TCP every 240s
      Port:          8080
      Initial delay: 0s
      Timeout:       240s
      Failure threshold: 1
      Type:          Default
  Service account:   xxxxxxxxxxxx-compute@developer.gserviceaccount.com
  Concurrency:       80
  Timeout:           300s

サービス URL を取得して、Nginx のウェルカムページにアクセスできることを確認します。

URL=$(gcloud run services describe $SERVICE_NAME \
  --region $REGION \
  --project $PROJECT_ID \
  --format 'value(status.url)')

curl "$URL"

<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

Nginx のウェルカムページにアクセスできました。

Nginxのウェルカムページ
Nginxのウェルカムページ

まとめ

今回の GA により、Cloud Run は Artifact Registry・Docker Hub に加えて GitHub Container Registry(ghcr.io)のパブリックイメージも直接デプロイのソースとしてサポートするようになりました。OSS ツールの評価や GitHub Actions ベースの CI/CD パイプラインと組み合わせた場合に、Artifact Registry へのイメージ転送というステップを省略できるため、開発体験が向上します。

ただし、いくつかの制限事項があります。対象はパブリックイメージのみで、プライベートイメージは引き続き Artifact Registry リモートリポジトリの設定が必要です。また、Google は本番環境での高可用性確保のために、GHCR や Docker Hub のイメージを Artifact Registry リモートリポジトリ経由でキャッシュする構成を推奨しています。用途に合わせて直接デプロイと Artifact Registry 経由を使い分けましょう。

この記事が誰かの助けになれば幸いです。

以上、クラウド事業本部コンサルティング部の渡邉でした!

この記事をシェアする

関連記事