Custom runtimes
Function Compute provides official built-in runtimes for mainstream programming languages such as Node.js, Python, PHP, Java, C#, and Go. When the built-in runtimes do not meet your needs, use a custom runtime to build a dedicated environment. For example, use Rust or specify a particular runtime version.
Use custom runtimes with web functions to quickly build popular web application frameworks and deploy HTTP-based web applications and services. Custom runtimes support custom startup commands, listening ports, and instance-level concurrency.
Supported container runtimes
Custom runtimes support the following runtime environments:
|
Runtime |
Identifier |
Operating system |
Architecture |
|
Custom runtime (Debian 12) |
custom.debian12 |
Debian 12 |
x86_64 |
|
Custom runtime (Debian 11) |
custom.debian11 |
Debian 11 |
x86_64 |
|
Custom runtime (Debian 10) |
custom.debian10 |
Debian 10 |
x86_64 |
|
Custom runtime (Debian 9) |
custom |
Debian 9 |
x86_64 |
|
Model Context Protocol (MCP) runtime (Node.js 20, Debian 10) |
nodejs20_mcp.debian10 |
Debian 10 |
x86_64 |
|
MCP runtime (Node.js 22, Debian 12) |
nodejs22_mcp.debian12 |
Debian 12 |
x86_64 |
|
MCP runtime (Python 3.10, Debian 10) |
python3.10_mcp.debian10 |
Debian 10 |
x86_64 |
|
MCP runtime (Python 3.13, Debian 12) |
python3.13_mcp.debian12 |
Debian 12 |
x86_64 |
MCP runtimes are preconfigured environments for MCP (Model Context Protocol) Server scenarios with built-in protocol support. Create a function with an MCP runtime to develop and deploy MCP Servers without additional protocol configuration. For session affinity, see Session affinity: General limitations and principles.
Functions created after 00:00:00 on December 1, 2021
-
Execution user: root.
-
Directory permissions: Data can be written to any directory.
-
Code location in the container: /code.
Functions created before 00:00:00 on December 1, 2021
-
Execution user: non-root.
-
Directory permissions: Data can only be written to the /tmp directory.
-
Code location in the container: /code.
Built-in dependencies
The built-in language dependencies of a custom runtime are the same as those of the corresponding language in the built-in runtimes.
When you create a web function with a custom runtime, the system automatically configures the official public layer for the corresponding programming language. For example, a Flask layer is configured by default for Python web functions.
Custom runtime (Debian 12)
The following programming languages are available in custom runtime (Debian 12). Python 3.11 is built in, and Python 3.12 requires a public layer. Create a custom runtime function in the built-in language versions directly, without installing third-party interpreters or configuring layers.
Some languages require environment variables. For details, see the following table:
|
Programming language |
Installation directory |
Version |
Environment variable |
|
Python 3.11 |
/usr/bin/python3 |
3.11.2 |
No extra settings required |
|
Python 3.12 |
/opt/python3.12 |
3.12.4 |
PATH=/opt/python3.12/bin:$PATH |
To use Python 3.12 in custom runtime (Debian 12), you must configure the public layer /Python312/versions/1 (see Configure official public layers). This differs from custom runtime (Debian 11), where Python 3.12 is built in.
Custom runtime (Debian 11)
Custom runtime (Debian 11) includes the following built-in programming language. Create a custom runtime function in this language version directly, without installing third-party interpreters or configuring layers.
Some languages require environment variables. For details, see the following table:
|
Programming language |
Installation directory |
Version |
Environment variable |
|
Python 3.12 |
/var/fc/lang/python3.12 |
3.12.4 |
PATH=/var/fc/lang/python3.12/bin:$PATH |
Custom runtime (Debian 10)
Custom runtime (Debian 10) includes the following built-in programming languages. Create a custom runtime function in these language versions directly, without installing third-party interpreters or configuring layers.
Some languages require environment variables. For details, see the following table:
|
Programming language |
Installation directory |
Version |
Environment variable |
|
Node.js 20 |
/var/fc/lang/nodejs20 |
v20.10.0 |
PATH=/var/fc/lang/nodejs20/bin:$PATH |
|
Node.js 18 |
/var/fc/lang/nodejs18 |
v18.19.0 |
PATH=/var/fc/lang/nodejs18/bin:$PATH |
|
Python 3.10 |
/var/fc/lang/python3.10 |
3.10.9 |
PATH=/var/fc/lang/python3.10/bin:$PATH |
|
Python 2.7 |
Default installation directory |
2.7.16 |
Not applicable |
Custom runtime (Debian 9)
Custom runtime (Debian 9) includes the following built-in programming languages. Create a custom runtime function in these language versions directly, without installing third-party interpreters or configuring layers.
-
Python 3.7.4 (default Python version)
-
Node.js 10.16.2
-
OpenJDK 1.8.0
-
Ruby 2.7
-
Nginx 1.10.3
-
PHP 7.4.12
Use a non-built-in programming language
Use official public layers to run non-built-in programming languages. For more information, see Configure official public layers.
When a built-in language of the custom runtime does not meet your needs, package its runtime or interpreter with your code files and deploy the package to Function Compute. The following example uses Node.js 16.
-
Download the Linux x64 version of
nodeto the code package directory.wget https://mirrors.aliyun.com/nodejs-release/v16.14.2/node-v16.14.2-linux-x64.tar.gz -O node-v16.14.2-linux-x64.tar.gz && tar -zxvf node-v16.14.2-linux-x64.tar.gz && rm -rf node-v16.14.2-linux-x64.tar.gz -
Set the startup command of the custom runtime to
node.customRuntimeConfig: command: - /code/node-v16.14.2-linux-x64/bin/node args: - 'server.js' # You can also configure the following environment variable for your function: PATH=/code/node-v16.14.2-linux-x64/bin:/usr/local/bin/apache-maven/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/ruby/bin. # After the configuration is complete, you can use node to start the HTTP server.