Runtime environment
The application is run in a virtual environment.
Runtime environment characteristics:
- Operating system: Ubuntu 22.04 LTS
- Linux kernel: 5.15
- Architecture: AMD64
Supported languages and images
You can write your application in any programming language and have it use any image that meets the following requirements:
- The executables are compiled under Linux x86_64.
- Available image formats: Docker Image Manifest V 2, Schema 2
and OCI Image Format .
Container response
The application must retrieve the number of the port for receiving requests, from the PORT
environment variable. The variable value is set by the service automatically.
After receiving a request, a container instance must send a response within the timeout specified in the Timeout, s field of the container revision settings. It includes the container instance launch time. Otherwise, the request terminates returning a 504 error.
Environment variables
The table provides a list of environment variables defined in the Serverless Containers runtime and available to an application. You cannot override these.
Key | Value |
---|---|
PORT | Network port the runtime uses to send HTTP requests to an application. |
You can add other environment variables when you create a container revision or build a Docker image. The limit for maximum environment variable size, including variable names, is 4 KB.
You cannot calculate environment variables. Environment variable values are string constants. You can only calculate these within application code.
You can retrieve environment variables using standard programming language tools.
File system
The container image files and directories are readable on the virtual environment file system. The file system is writable. The space available for writing is limited. For more detail, please see Quotas and limits.
The file system is stored in RAM. Data written to the file system is not saved when a container instance is stopped.
Container instance resources
CPU
A CPU resource is allocated whenever a container instance is processing at least one request. Currently, no more than 4 vCPUs can be allocated.
RAM
Each container instance is allocated RAM. The default value is 128 MB.
For example, RAM is consumed for:
- File system writes
- Container process launches
- Request processing
Ratio between RAM and vCPU
The number of available cores depends on the specified RAM size.
RAM | CPU |
---|---|
128 MB to less than 4 GB | 1 vCPU with a guaranteed vCPU share up to 100% |
4 GB to less than 6 GB | 2 vCPU with a guaranteed vCPU share up to 100% |
6 GB to less than 8 GB | 3 vCPU with a guaranteed vCPU share up to 100% |
8 GB | 4 vCPU with a guaranteed vCPU share up to 100% |
Metadata service
The metadata service is available inside the container's virtual runtime environment. Using it, you can get an IAM token for a service account if you specified the service account when creating the container revision.