Creating a container revision
You need to create a new revision:
- When you upload a new Docker image version to Container Registry.
- When you modify revision settings.
Note
To ensure the integrity of version links, you cannot update or delete container revisions.
If a registry or repository containing the Docker image is not public, you need to specify a service account with permission to download the Docker image in the revision settings. For example, the container-registry.images.puller
role to the folder or registry containing the Docker image.
If a service account is specified in the revision settings, the user or the service account creating the revision must have the iam.serviceAccounts.user
role. It confirms the right to use the service account.
- In the management console
, select the folder with your container. - Select Serverless Containers.
- Select the container whose revision you want to create.
- Go to the Editor tab.
- Specify the revision parameters.
- Click Create revision.
To create a container revision, run this command:
yc serverless container revision deploy \
--container-name <container_name> \
--image <Docker_image_URL> \
--cores 1 \
--memory 1GB \
--concurrency 1 \
--execution-timeout 30s \
--service-account-id <service_account_ID>
Where:
-
--cores
: Number of cores available for the container. -
--memory
: Required memory. The default value is 128 MB. -
--concurrency
: Maximum number of concurrent requests to a single container instance. May be in the range between 1 (default) and 16. If the number of requests to a container exceeds theconcurrency
value, Yandex Serverless Containers scales the container up by running its additional instances.Note
The number of container instances and concurrent container requests in each zone cannot exceed the quota.
-
--execution-timeout
: Timeout. The default value is 3 seconds. -
--service-account-id
: ID of the service account authorized to download an image.
Result:
id: bbajn5q2d74c********
container_id: bba3fva6ka5g********
created_at: "2021-07-09T15:04:55.135Z"
image:
image_url: cr.yandex/crpd3cicopk7********/test-container:latest
image_digest: sha256:de8e1dce7ceceeafaae122f7670084a1119c961cd9ea1795eae92bd********
resources:
memory: "1073741824"
cores: "1"
execution_timeout: 3s
service_account_id: ajeqnasj95o7********
status: ACTIVE
Terraform
For more information about the provider resources, see the documentation on the Terraform
If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.
If you don't have Terraform, install it and configure the Yandex Cloud provider.
In Terraform, a new revision is created every time the resource runtime parameters are updated.
To create a revision:
-
Update the
yandex_serverless_container
resource runtime parameters in the configuration file:provider "yandex" { token = "<OAuth>" cloud_id = "<cloud_ID>" folder_id = "<folder_ID>" zone = "ru-central1-a" } resource "yandex_serverless_container" "test-container" { name = "<container_name>" memory = <memory_size> service_account_id = "<service_account_ID>" image { url = "<Docker_image_URL>" } }
For more information about the
yandex_serverless_container
resource in Terraform, see the provider documentation . -
Make sure the configuration files are valid.
-
In the command line, navigate to the folder where the configuration file was created.
-
Run a check using this command:
terraform plan
If the configuration is described correctly, the terminal will display a list of resources being created or updated and their parameters. If the configuration contains any errors, Terraform will point them out.
-
-
If the configuration does not contain any errors, run this command:
terraform apply
-
Confirm the resource creation or update: type
yes
in the terminal and press Enter.This will create the revision. You can check the new revision using the management console
or this CLI command:yc serverless container revision list
To create a container revision, use the deployRevision REST API method for the Container resource or the ContainerService/DeployRevision gRPC API call.