すべてのプロダクト
Search
ドキュメントセンター

Function Compute:公式パブリックレイヤーの設定

最終更新日:Apr 01, 2026

すべての依存関係を各関数のデプロイメントパッケージに含めると、アーカイブが大きくなり、関数間で作業が重複します。Function Compute は、一般的なランタイムと依存ライブラリのために公式パブリックレイヤーを提供しています。パブリックレイヤーを追加することで、毎回再ビルドすることなく、関数間で依存関係を共有できます。

パブリックレイヤー

以下の表は、利用可能なパブリックレイヤーをカテゴリ別に示しています。完全なリストについては、「パブリックレイヤー」をご参照ください。リストにないレイヤーが必要な場合は、お問い合わせください。

カスタムランタイム

これらのレイヤーは、Python 3.10 や Node.js 17 などのカスタムランタイム向けの実行環境を提供します。一部のレイヤーには、一般的な依存ライブラリもバンドルされています。たとえば、Python310-Package-Collection には、頻繁に使用される Python パッケージが含まれています。

パブリックレイヤー互換性のあるランタイム説明リファレンス
PHP81-Debian10Custom.Debian10PHP 8.1 Debian 10 ランタイムレイヤーREADME.md
PHP80-Debian10Custom.Debian10PHP 8.0 Debian 10 ランタイムレイヤーREADME.md
NginxCustom.Debian10Nginx Debian 10 ランタイムレイヤーREADME.md
Python310Custom, Custom.Debian10Python 3.10.5 ランタイムレイヤーREADME.md
Python310-Package-CollectionCustom.Debian10Python 3.10 ランタイム用の一般的な依存ライブラリのコレクションREADME.md
Python39Custom, Custom.Debian10Python 3.9.13 ランタイムレイヤーREADME.md
Python39-Package-CollectionCustom, Custom.Debian10Python 3.9 ランタイム用の一般的な依存ライブラリのコレクションREADME.md
Python38Custom, Custom.Debian10Python 3.8.13 ランタイムレイヤーREADME.md
Python38-Package-CollectionCustom, Custom.Debian10Python 3.8.13 ランタイム用の一般的な依存ライブラリのコレクションREADME.md
Python36CustomPython 3.6.15 ランタイムレイヤーREADME.md
Python36-Package-CollectionCustomPython 3.6.15 ランタイム用の一般的な依存ライブラリのコレクションREADME.md
Dotnet6Custom, Custom.Debian10ASP.NET 6.0.5 ランタイムレイヤーREADME.md
PHP72CustomPHP 7.2 ランタイムレイヤーREADME.md
Java8Custom.Debian10Java 8 ランタイムレイヤーREADME.md
Java11Custom, Custom.Debian10Java 11 ランタイムレイヤーREADME.md
Java17Custom, Custom.Debian10Java 17 ランタイムレイヤーREADME.md
Java21Custom.Debian10Java 21 ランタイムレイヤーREADME.md
Nodejs20Custom.Debian10Node.js 20 ランタイムレイヤーREADME.md
Nodejs18Custom.Debian10Node.js 18 ランタイムレイヤーREADME.md
Nodejs17CustomNode.js 17 ランタイムレイヤーREADME.md
Nodejs16Custom, Custom.Debian10Node.js 16 ランタイムレイヤーREADME.md
Nodejs14CustomNode.js 14 ランタイムレイヤーREADME.md
Nodejs12CustomNode.js 12 ランタイムレイヤーREADME.md
Go1Custom.Debian10Go 1 ランタイムレイヤーREADME.md
Go118CustomGo 1.x ランタイムレイヤーREADME.md

共通依存ライブラリ

パブリックレイヤー互換性のあるランタイム説明コアライブラリのバージョンリファレンス
Python310-OSS2Python 3.10, Custom.Debian10oss2: Python 用 OSS SDK-README.md
Python39-OSS2Python 3.9, Custom.Debian10oss2: Python 用 OSS SDK-README.md
Python310-TensorFlow2xPython 3.10, Custom.Debian10オープンソースの機械学習フレームワーク (CPU 版)tensorflow==2.15.0.post1README.md
Python3x-PyMongo4xPython 3.10, Custom.Debian10オープンソースの科学計算ライブラリPyMongo==4.6.1README.md
Python3x-Pandas2xPython 3.9, Custom.Debian10NumPy をベースにしたオープンソースのデータ分析・処理ツールpandas==2.2.1README.md
Python310-PyTorch2xPython 3.10, Custom.Debian10オープンソースの機械学習フレームワーク (CPU 版)torch==2.2.1+cpuREADME.md
Python39-Pandas1xPython 3.9, Custom, Custom.Debian10NumPy をベースにしたオープンソースのデータ分析・処理ツールpandas==1.4.3README.md
Python39-SciPy1xPython 3.9, Custom, Custom.Debian10オープンソースの科学計算ライブラリscipy==1.9.0, numpy==1.23.2README.md
Python36-SciPy1xPython 3.6, Customオープンソースの科学計算ライブラリscipy-1.5.4, numpy-1.19.5README.md
Python39-PyTorch1xPython 3.9, Custom, Custom.Debian10オープンソースの機械学習フレームワーク (CPU 版)torch==1.12.1+cpu, torchaudio==0.12.1+cpu, torchvision==0.13.1+cpuREADME.md
Python36-PyTorch1xPython 3.6, Customオープンソースの機械学習フレームワーク (CPU 版)torch==1.10.2+cpu, torchaudio==0.10.2+cpu, torchvision==0.11.3+cpuREADME.md
Python3-Flask2xPython 3.9, Python 3.10, Custom, Custom.Debian10Python ベースの軽量 Web フレームワークflask-v2.2.2README.md
Nodejs-Puppeteer17xNode.js 16, Node.js 14, Custom, Custom.Debian10ヘッドレス Chrome ツールpuppeteer-v17.1.0README.md
Nodejs-Puppeteer10xNode.js 14, Node.js 12, Node.js 10, Customヘッドレス Chrome ツールpuppeteer-v10.2.0README.md
Nodejs-Puppeteer19xCustom.Debian10ヘッドレス Chrome ツールpuppeteer-v19.8.5README.md
Python310-Opencv4xPython 3.10, Custom.Debian10コンピュータビジョン向けのクロスプラットフォームライブラリopencv_python-4.7.0.68README.md
Python38-PlaywrightCustom.Debian10Web ページ自動化ツールplaywright==1.31.1README.md
Poppler22x-Pdf2imagePython 3.10PDF ドキュメントをレンダリングするためのライブラリpdf2image-1.16.3, poppler-22.12.0README.md
SQLite3Python 3.9, Node.js 16, Node.js 14, Java 11, Java 8, Custom軽量なインプロセスリレーショナルデータベース3.41.1README.md
FFmpeg6xPython 3.10, Python 3.9, Node.js 16, Node.js 14, Java 11, Java 8, Custom, Custom.Debian10音声と映像の録画、変換、ストリーミングを行うためのオープンソースツールキット6.0README.md
ServerlessDevsPython 3.10, Python 3.9, Python 3, Node.js 16, Node.js 14, Java 11, Java 8, Go 1, .NetCore 3.1, PHP 7.2, Custom, Custom.Debian10開発者向けに堅牢なツールセットを提供するオープンソースのサーバーレスプラットフォーム2.1.14README.md

Web フレームワーク

パブリックレイヤー互換性のあるランタイムコアライブラリのバージョンリファレンス
Python3-Flask2xPython 3.9, Python 3.10, Custom, Custom.Debian10flask-2.2.2README.md

Alibaba Cloud SDK

パブリックレイヤー互換性のあるランタイム説明リファレンス
Python310-Aliyun-SDKPython 3.10, Custom.Debian10Python 3.10 用の一般的な Alibaba Cloud SDKREADME.md
Python39-Aliyun-SDKPython 3.9, CustomPython 3.9 用の一般的な Alibaba Cloud SDKREADME.md
Python36-Aliyun-SDKPython 3.6, CustomPython 3.6 用の一般的な Alibaba Cloud SDKREADME.md
Nodejs-Aliyun-SDKNode.js 20, Node.js 18, Node.js 16, Node.js 14, Custom, Custom.Debian10一般的な Alibaba Cloud SDK (Node.js 20、Node.js 18、Node.js 16、および Node.js 14)README.md
Aliyun-DataXPython 3.6, Python 3.9, Custom, Custom.Debian10Alibaba Cloud DataWorks データ統合のオープンソース版README.md

レイヤーの仕組み

1 つの関数は、カスタムレイヤーとパブリックレイヤーを合わせて最大 5 つのレイヤーをサポートします。複数のレイヤーが設定されている場合、Function Compute はその内容を設定とは逆の順序で /opt ディレクトリにマージします。2 つのレイヤーに同じ名前のファイルが含まれている場合、最初に設定されたレイヤーのファイルが、後から設定されたレイヤーのファイルよりも優先されます。

コンソールでのパブリックレイヤーの追加

前提条件

開始する前に、以下を確認してください。

  • Function Compute の関数。作成方法については、「関数の作成」をご参照ください。

レイヤーの追加

  1. Function Compute コンソールにログインします。左側のナビゲーションウィンドウで、 [関数] をクリックします。

  2. 上部のナビゲーションバーでリージョンを選択します。 [関数] ページで、設定する関数の名前をクリックします。

  3. 関数詳細ページで、 [設定] タブをクリックします。

  4. 左側のナビゲーションツリーで [レイヤー] をクリックし、次に [変更] をクリックします。

  5. [レイヤー] パネルで [+ レイヤーの追加] をクリックし、 [公式共通レイヤーの追加] を選択します。 [公式共通レイヤー] ドロップダウンリストからレイヤーを、 [レイヤーバージョン] ドロップダウンリストからバージョンを選択し、 [デプロイ] をクリックします。

Serverless Devs を使用したパブリックレイヤーの追加

前提条件

開始する前に、以下を確認してください。

  • Serverless Devs がインストールされ、Docker が設定済みである必要があります。詳細については、「クイックスタート」をご参照ください。

  • ご利用の認証情報で Serverless Devs が設定されていること。詳細については、「Serverless Devs の設定」をご参照ください。

レイヤーの追加

  1. 次のコマンドを実行して、リージョン内の公式パブリックレイヤーをリスト表示します。

    s cli fc layer list --official --region cn-hangzhou

    出力には、利用可能なレイヤーとその ARN がリスト表示されます。使用したいレイヤーの ARN をコピーします。

    -
      layerName:         Python39-Aliyun-SDK
      arn:               acs:fc:cn-hangzhou:official:layers/Python39-Aliyun-SDK/versions/3
      version:           3
      acl:               1
      description:       Python3.9 Aliyun SDK layer.
      compatibleRuntime:
        - custom
        - python3.9
        - custom.debian10
    -
      layerName:         Python39-Package-Collection
      arn:               acs:fc:cn-hangzhou:official:layers/Python39-Package-Collection/versions/3
      version:           3
      acl:               1
      description:       Python3.9 package collection layer.
      compatibleRuntime:
        - custom
        - custom.debian10

    出力の主要なフィールド:

    フィールド説明
    layerNameレイヤーの名前
    versionレイヤーバージョン
    arnレイヤーバージョンにアタッチする際に使用される ARN
    aclアクセス制御: 0 = 非公開、1 = パブリック
    descriptionレイヤーの簡単な説明
    compatibleRuntimeこのレイヤーがサポートするランタイム
  2. プロジェクトディレクトリに s.yaml ファイルを作成し、レイヤーの ARN を layers フィールドに追加します。

    edition: 3.0.0
    name: hello-world-app
    access: "default"
    
    vars: # グローバル変数
      region: "cn-hangzhou"
    
    resources:
      hello_world:
        component: fc3 # コンポーネント名
        actions:       # カスタム実行ロジック
        props:
          region: ${vars.region}
          functionName: "emoji"
          description: 'this is a layer demo'
          runtime: "python3.9"
          code: ./code
          handler: index.handler
          memorySize: 512
          timeout: 60
          internetAccess: true
          layers:    # 関数にアタッチされたレイヤーの ARN
            - acs:fc:cn-hangzhou:official:layers/Python39-Aliyun-SDK/versions/3
  3. プロジェクトディレクトリに code ディレクトリを作成し、その中に関数コードを配置します。

  4. 次のコマンドを実行して、レイヤーが設定された関数をデプロイします。

    s deploy

次のステップ