支援的語言執行階段和基本映像檔

本頁說明從來源部署服務函式,以及從頭建構的容器映像檔時,支援的語言執行階段和基礎映像檔。

基本映像檔由作業系統堆疊和語言執行階段組成:

  • 堆疊由 Linux 發行版本和系統套件 (例如 OpenSSL 和 curl) 組成。
  • 語言執行階段是應用程式使用的程式設計語言特定版本。

Cloud Run 支援多種語言執行階段,每種執行階段都可透過 Google Cloud 的 Buildpacks 提供的容器基礎映像檔使用。只有在語言執行階段獲得各自的開放原始碼社群支援時,我們才會提供支援。

開發人員有責任在支援期限結束前,將服務升級至較新的語言執行階段。詳情請參閱 Cloud Run 執行階段生命週期

Cloud Run 生命週期政策不適用於在 Cloud Run 以外建構的容器。

使用語言執行階段

Cloud Run 語言執行階段可用於下列用途:

安全性與維護更新

正式發布的語言執行階段可取得安全性與維護更新。您可以視自動安全性更新的設定方式,自動或手動套用這些更新。 將函式和服務部署至 Cloud Run 時,系統預設會啟用自動安全性更新。

如何取得基本映像檔

基本映像檔會託管在提供 Artifact Registry 的所有區域

指定基礎圖片的方法有三種:

  • RUNTIME_ID:使用預設堆疊,為指定語言提供基礎映像檔。基礎映像檔會取自服務部署所在位置的存放區。REGION在大多數情況下,建議您指定 RUNTIME_ID
  • STACK/RUNTIME_ID:完整基礎圖片路徑的別名。基本映像檔會取自服務部署所在位置的存放區。REGION如需堆疊中的特定系統套件,請使用這個選項。
  • REGION-docker.pkg.dev/serverless-runtimes/STACK/runtimes/RUNTIME_ID: 完整基本圖片路徑。如要完全掌控特定基礎映像檔和下載來源區域,請使用這個選項。

如要瞭解指定基礎圖片的三種方法,請替換:

  • REGION 替換為偏好的地區,例如 europe-west1
  • STACK 偏好的作業系統 堆疊,例如 google-22-full
  • RUNTIME_ID 替換為函式使用的語言執行階段 ID,例如 nodejs22

舉例來說,如要使用 google-22-full 堆疊,參照 europe-west1 中代管的最新 Node.js 20 基本映像檔完整路徑,請使用下列網址:

europe-west1-docker.pkg.dev/serverless-runtimes/google-22-full/runtimes/nodejs22

Node.js

執行階段 執行階段 ID 堆疊 執行階段基礎映像檔
Node.js 22 nodejs22
  • google-22 (預設)
  • google-22-full
  • google-22/nodejs22
  • google-22-full/nodejs22
  • Node.js 20 nodejs20
  • google-22 (預設)
  • google-22-full
  • google-22/nodejs20
  • google-22-full/nodejs20
  • Node.js 18 nodejs18
  • google-22 (預設)
  • google-22-full
  • google-22/nodejs18
  • google-22-full/nodejs18
  • Node.js 16 nodejs16 google-18-full google-18-full/nodejs16
    Node.js 14 nodejs14 google-18-full google-18-full/nodejs14
    Node.js 12 nodejs12 google-18-full google-18-full/nodejs12
    Node.js 10 nodejs10 google-18-full google-18-full/nodejs10
    Node.js 8 nodejs8 已停用 已停用
    Node.js 6 nodejs6 已停用 已停用

    Python

    執行階段 執行階段 ID 堆疊 執行階段基礎映像檔
    Python 3.13 python313
  • google-22 (預設)
  • google-22-full
  • google-22/python313
  • google-22-full/python313
  • Python 3.12 python312
  • google-22 (預設)
  • google-22-full
  • google-22/python312
  • google-22-full/python312
  • Python 3.11 python311
  • google-22 (預設)
  • google-22-full
  • google-22/python311
  • google-22-full/python311
  • Python 3.10 python310
  • google-22 (預設)
  • google-22-full
  • google-22/python310
  • google-22-full/python310
  • Python 3.9 python39 google-18-full google-18-full/python39
    Python 3.8 python38 google-18-full google-18-full/python38
    Python 3.7 python37 google-18-full google-18-full/python37

    Go

    執行階段 執行階段 ID 堆疊 執行階段基礎映像檔
    Go 1.23
    go123
  • google-22 (預設)
  • google-22-full
  • google-22/go123
  • google-22-full/go123
  • Go 1.22 go122
  • google-22 (預設)
  • google-22-full
  • google-22/go122
  • google-22-full/go122
  • Go 1.21 go121
  • google-22 (預設)
  • google-22-full
  • google-22/go121
  • google-22-full/go121
  • Go 1.20 go120
  • google-22 (預設)
  • google-22-full
  • google-22/go120
  • google-22-full/go120
  • Go 1.19 go119
  • google-22 (預設)
  • google-22-full
  • google-22/go119
  • google-22-full/go119
  • Go 1.18 go118
  • google-22 (預設)
  • google-22-full
  • google-22/go118
  • google-22-full/go120
  • Go 1.16 go116 google-18-full google-18-full/go116
    Go 1.13 go113 google-18-full google-18-full/go113
    Go 1.11 go111 已停用 已停用

    Java

    執行階段 執行階段 ID 堆疊 執行階段基礎映像檔
    Java 21 java21
  • google-22 (預設)
  • google-22-full
  • google-22/java21
  • google-22-full/java21
  • Java 17 java17
  • google-22 (預設)
  • google-22-full
  • google-22/java17
  • google-22-full/java17
  • Java 11 java11 google-18-full google-18-full/java11

    Ruby

    執行階段 執行階段 ID 堆疊 執行階段基礎映像檔
    Ruby 3.4 ruby34
  • google-22 (預設)
  • google-22-full
  • google-22/ruby34
  • google-22-full/ruby34
  • Ruby 3.3 ruby33
  • google-22 (預設)
  • google-22-full
  • google-22/ruby33
  • google-22-full/ruby33
  • Ruby 3.2 ruby32
  • google-22 (預設)
  • google-22-full
  • google-22/ruby32
  • google-22-full/ruby32
  • Ruby 3.0 ruby30 google-18-full google-18-full/ruby30
    Ruby 2.7 ruby27 google-18-full google-18-full/ruby27
    Ruby 2.6 ruby26 google-18-full google-18-full/ruby26

    PHP

    執行階段 執行階段 ID 堆疊 執行階段基礎映像檔
    PHP 8.4 php84 google-22-full (預設) google-22-full/php84
    PHP 8.3 php83 google-22-full (預設) google-22-full/php83
    PHP 8.2 php82 google-22-full (預設) google-22-full/php82
    PHP 8.1 php81 google-18-full google-18-full/php81
    PHP 7.4 php74 google-18-full google-18-full/php74

    .NET

    執行階段 執行階段 ID 堆疊 執行階段基礎映像檔
    .NET 8 dotnet8
  • google-22 (預設)
  • google-22-full
  • google-22/dotnet8
  • google-22-full/dotnet8
  • .NET 6 dotnet6
  • google-22 (預設)
  • google-22-full
  • google-22/dotnet6
  • google-22-full/dotnet6
  • .NET Core 3 dotnet3 google-18-full google-18-full/dotnet3