Updates an elastic container instance.
Operation Description
- You can update only elastic container instances that are in the Pending or Running state. After you call this operation to update an elastic container instance, the instance enters the Updating state.
- You cannot update elastic container instances that were created before 15:00:00 March 7, 2019.
debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
eci:UpdateContainerGroup | WRITE |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | The region ID of the instance. | cn-hangzhou |
ContainerGroupId | string | Yes | The ID of the elastic container instance that you want to update. | eci-2zelg8vwnlzdhf8hv**** |
RestartPolicy | string | No | The restart policy of the elastic container instance. Valid values:
| Always |
ClientToken | string | No | The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must ensure that the value is unique among different requests. The token can only contain ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotency. | 123e4567-e89b-12d3-a456-426655440000 |
Cpu | float | No | The number of vCPUs allocated to the elastic container instance. | 2.0 |
Memory | float | No | The memory size allocated to the elastic container instance. Unit: GiB. | 4.0 |
ResourceGroupId | string | No | The ID of the resource group. | rg-2df3isufhi38**** |
Tag | object [] | No | The tags that are bound to the instance. | |
Key | string | No | The key of the tag. | name |
Value | string | No | The value of the tag. | hxh |
Volume | object [] | No | The volumes that are mounted to the instance. | |
Name | string | No | The name of the volume. | test-empty |
Type | string | No | The type of the HostPath volume. Valid values:
Note
This parameter is unavailable.
| EmptyDirVolume |
NFSVolume.Path | string | No | The path to mount the NFS volume. | / |
NFSVolume.Server | string | No | The domain name of the mount target of the NFS volume. | 071e349b04-bsd39.cn-hangzhou.nas.aliyuncs.com |
NFSVolume.ReadOnly | boolean | No | Specifies whether the permissions on the NFS volume are read-only. Valid values:
| false |
ConfigFileVolume.ConfigFileToPath | object [] | No | The information about the configuration file of the ConfigFile volume. | |
Path | string | No | The relative path of the configuration file. | jin/test |
Content | string | No | The content of the configuration file. The value is Base64-encoded. | bGl1bWk= |
EmptyDirVolume.Medium | string | No | The storage media of emptyDir volume N. This parameter is empty by default. In this case, node file system is used as the storage media. You can also set this parameter to memory to use memory as the storage media. | Memory |
EmptyDirVolume.SizeLimit | string | No | The storage size of the emptyDir volume. The value contains a unit. We recommend that you use Gi or Mi as the unit. | 256Mi |
FlexVolume.FsType | string | No | The file system type of the disk when you use the FlexVolume plug-in to mount the disk. Valid values: ext4, ext3, xfs, and vfat. Default value: ext4. | ext4 |
FlexVolume.Driver | string | No | The driver type when you use the FlexVolume plug-in to mount a volume. Valid values:
| alicloud/disk |
FlexVolume.Options | string | No | The options when you set the Type parameter to FlexVolume. Each option is a key-value pair in a JSON string. For example, if you use FlexVolume to mount a disk, this parameter indicates the configuration parameters of the disk. For more information, see Overview of volumes. | {"volumeId":"d-2zehdahrwoa7srg****","performanceLevel": "PL2"}` |
HostPathVolume.Path | string | No | The path of the HostPath volume on the host. Note
This parameter is unavailable.
| /tmp |
DnsConfig.Search | array | No | The search domains of the Domain Name System (DNS) server. | |
string | No | The search domains of the DNS server. | my.dns.search.suffix | |
DnsConfig.NameServer | array | No | The IP addresses of the DNS servers. | |
string | No | The IP addresses of the DNS servers. | 1.2.3.4 | |
DnsConfig.Option | object [] | No | The configurations of DNS. | |
Value | string | No | The option value of DNS configurations. | 2 |
Name | string | No | The option name of DNS configurations. | ndots |
Container | object [] | No | The new configurations of the container group. | |
ReadinessProbe.TimeoutSeconds | integer | No | The period of time after which the probe times out. Unit: seconds. Default value: 1. Minimum value: 1. | 5 |
ReadinessProbe.SuccessThreshold | integer | No | The minimum number of consecutive successes that must occur for the check to be considered successful. Default value: 1. | 1 |
SecurityContext.Capability.Add | array | No | The permissions granted to processes in the container. Valid values: NET_ADMIN and NET_RAW. Note
To use NET_RAW, you must submit a ticket.
| |
string | No | The permissions granted to processes in the container. Valid values: NET_ADMIN and NET_RAW. Note
To use NET_RAW, you must submit a ticket.
| NET_ADMIN | |
ReadinessProbe.HttpGet.Scheme | string | No | The protocol type of HTTP GET requests when you use HTTP requests to perform health checks. Valid values:
| HTTP |
LivenessProbe.PeriodSeconds | integer | No | The interval at which the probe is run. Unit: seconds. Default value: 10. Minimum value: 1. | 10 |
SecurityContext.ReadOnlyRootFilesystem | boolean | No | Specifies whether permissions on the root file system are read-only. Set the value to true. | true |
EnvironmentVar | object [] | No | The environment variables for the container. | |
Key | string | No | The name of the environment variable for the container. | PATH |
Value | string | No | The value of the environment variable for the container. | /usr/bin/local/ |
FieldRef.FieldPath | string | No | The pod field that is used as the environment variable for the container. Set the value to status.podIP. | status.podIP |
Tty | boolean | No | Specifies whether to enable interaction. Default value: false. If the command is a /bin/bash command, set the value to true. | false |
WorkingDir | string | No | The working directory of the container. | /usr/share/ |
Arg | array | No | The arguments that are passed to the container startup command. You can specify up to 10 arguments. | |
string | No | The arguments that are passed to the container startup command. | hello | |
Stdin | boolean | No | Specifies whether the container allocates buffer resources to standard input streams when the container is running. If you do not specify this parameter, an end-of-file (EOF) error may occur when standard input streams in the container are read. Default value: false. | false |
LivenessProbe.InitialDelaySeconds | integer | No | The number of seconds between the time when the startup of the container ends and the time when the probe starts. | 10 |
VolumeMount | object [] | No | Pod volumes to mount into the filesystem of the container. | |
MountPropagation | string | No | The mount propagation setting of the volume. Mount propagation allows volumes that are mounted on one container to be shared with other containers in the same pod, or even with other pods on the same node. Valid values:
Default value: None. | None |
MountPath | string | No | The directory of the volume that is mounted to the container. The data in this directory is overwritten by the data on the volume. Specify this parameter with caution. | /usr/share/ |
ReadOnly | boolean | No | Specifies whether the volume is read-only. Default value: false. | false |
SubPath | string | No | The subdirectory of the volume that is mounted to the container. The pod can mount different directories of the same volume to different subdirectories of containers. | /usr/share/sub/ |
Name | string | No | The name of the volume that is mounted to the container. Valid values: the values of Volume.N.Name, which are the names of volumes that are mounted to the elastic container instance. | test-empty |
ImagePullPolicy | string | No | The image pulling policy. | Never |
StdinOnce | boolean | No | Whether the container runtime closes the stdin channel after the stdin channel has been opened by a sing attach. If stdin is true, the stdin stream remains open across multiple attach sessions. If StdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and receive data until the client disconnects. When the client disconnects, stdin is closed and remains closed until the container is restarted. | true |
LifecyclePreStopHandlerTcpSocketPort | integer | No | The port of TCP socket probes when you use TCP sockets to specify the preStop callback function. | 80 |
LifecyclePostStartHandlerHttpGetScheme | string | No | The path to which HTTP GET requests are sent when you use HTTP requests to specify the postStart callback function. | /healthyz |
ReadinessProbe.PeriodSeconds | integer | No | The interval at which the container is checked. Unit: seconds. Default value: 10. Minimum value: 1. | 3 |
LivenessProbe.SuccessThreshold | integer | No | The minimum number of consecutive successes that must occur for the probe to be considered successful. Set the value to 1. | 1 |
Command | array | No | The commands that are used to run the probe. | |
string | No | The commands that are used to run the probe. | echo | |
LifecyclePostStartHandlerHttpGetHost | string | No | The IP address of the host that receives HTTP GET requests when you use HTTP requests to specify the postStart callback function. | hide |
ReadinessProbe.HttpGet.Path | string | No | The path to which the system sends an HTTP GET request for a health check. | /usr/ |
LifecyclePostStartHandlerTcpSocketPort | integer | No | The port of TCP socket probes when you use TCP sockets to specify the postStart callback function. | 1 |
LifecyclePostStartHandlerHttpGetPath | string | No | The path to which HTTP GET requests are sent when you use HTTP requests to specify the postStart callback function. | /healthyz |
LifecyclePostStartHandlerExec | array | No | The command that you run in the container when you use a command-line interface (CLI) to specify the postStart callback function. | |
string | No | The command that you run in the container when you use a CLI to specify the postStart callback function. | ["/bin/sh", "-c", "echo Hello from the postStart handler > /usr/share/message"] | |
LifecyclePreStopHandlerHttpGetPath | string | No | The path to which HTTP GET requests are sent when you use HTTP requests to specify the preStop callback function. | /healthyz |
Port | object [] | No | The port to which the system sends an HTTP GET request for a health check. | |
Protocol | string | No | The protocol of the container. Valid values: TCP and UDP. | TCP |
Port | integer | No | The port number. Valid values: 1 to 65535. | 8080 |
LifecyclePreStopHandlerHttpGetScheme | string | No | The protocol type of HTTP GET requests when you use HTTP requests to specify the preStop callback function. Valid values:
| HTTP |
LivenessProbe.HttpGet.Scheme | string | No | The protocol type of HTTP GET requests when you use HTTP requests to perform health checks. Valid values:
| HTTP |
LifecyclePostStartHandlerHttpGetHttpHeaders | object [] | No | The information about the valid HTTP request headers among the generated HTTP request headers. | |
Value | string | No | The request parameter value of HTTP GET requests when you use HTTP requests to specify the postStart callback function. | test |
Name | string | No | The request parameter of HTTP GET requests when you use HTTP requests to specify the postStart callback function. | testValue |
LifecyclePostStartHandlerTcpSocketHost | string | No | The host IP address of TCP socket probes when you use TCP sockets to specify the postStart callback function. | 10.0.XX.XX |
Gpu | integer | No | The number of GPUs that you want to allocate to the container. | 1 |
ReadinessProbe.InitialDelaySeconds | integer | No | The number of seconds between the time when the startup of the container ends and the time when the check starts. | 10 |
LifecyclePreStopHandlerExec | array | No | The command that you run in the container when you use a CLI to specify the preStop callback function. | |
string | No | The command that you run in the container when you use a CLI to specify the preStop callback function. | ["/bin/sh", "-c","echo Hello from the preStop handler > /usr/share/message"] | |
Memory | float | No | The memory size of the container. | 2.0 |
Name | string | No | The name of the container. | jenkins |
LifecyclePreStopHandlerHttpGetHost | string | No | The IP address of the host that receives HTTP GET requests when you use HTTP requests to specify the preStop callback function. | 10.0.XX.XX |
LifecyclePreStopHandlerTcpSocketHost | string | No | The host IP address of TCP socket probes when you use TCP sockets to specify the preStop callback function. | 10.0.XX.XX |
Image | string | No | The image of the container. | jenkins |
LifecyclePreStopHandlerHttpGetPort | integer | No | The port to which HTTP GET requests are sent when you use HTTP requests to specify the preStop callback function. | 1 |
LivenessProbe.FailureThreshold | integer | No | The minimum number of consecutive failures that must occur for the probe to be considered failed. Default value: 3. | 3 |
LifecyclePreStopHandlerHttpGetHttpHeader | object [] | No | The information about the generated HTTP request headers. | |
Value | string | No | The request parameter value of HTTP GET requests when you use HTTP requests to specify the preStop callback function. | testValue |
Name | string | No | The request parameter of HTTP GET requests when you use HTTP requests to specify the preStop callback function. | test |
ReadinessProbe.FailureThreshold | integer | No | The minimum number of consecutive failures that must occur for the probe to be considered failed. Default value: 3. | 3 |
Cpu | float | No | The number of vCPUs that you want to allocate to the container. | 1.0 |
LivenessProbe.HttpGet.Path | string | No | The path to which the system sends an HTTP GET request for a health check. | /usr/local/bin |
LivenessProbe.TimeoutSeconds | integer | No | The period of time after which the probe times out. Unit: seconds. Default value: 1. Minimum value: 1. | 1 |
SecurityContext.RunAsUser | long | No | The user ID (UID) that is used to run the entry point of the container process. | 1377 |
LifecyclePostStartHandlerHttpGetPort | integer | No | The port to which HTTP GET requests are sent when you use HTTP requests to specify the postStart callback function. | 1 |
InitContainer | object [] | No | The information about the new init containers. | |
SecurityContext.Capability.Add | array | No | The permissions that you want to granted to processes in the init container. Valid values: NET_ADMIN and NET_RAW. Note
To use NET_RAW, you must submit a ticket.
| |
string | No | The permissions that you want to granted to processes in the init container. Valid values: NET_ADMIN and NET_RAW. Note
To use NET_RAW, you must submit a ticket.
| NET_ADMIN | |
Image | string | No | The image of the init container. | nginx |
VolumeMount | object [] | No | Pod volumes to mount into the filesystem of the init container. | |
MountPropagation | string | No | The mount propagation setting of the volume. Mount propagation allows volumes that are mounted on one container to be shared with other containers in the same pod, or even with other pods on the same node. Valid values:
Default value: None. | None |
MountPath | string | No | The directory of the volume that is mounted to the init container. The data in this directory is overwritten by the data on the volume. Specify this parameter with caution. | /pod/data |
ReadOnly | boolean | No | Specifies whether the volume is read-only. Default value: false. | false |
SubPath | string | No | The subdirectory of the volume that is mounted to the init container. The pod can mount different directories of the same volume to different subdirectories of init containers. | data2/ |
Name | string | No | The name of the volume that is mounted to the init container. Valid values: the values of Volume.N.Name, which are the names of volumes that are mounted to the elastic container instance. | default-volume1 |
Port | object [] | No | The port number. Valid values: 1 to 65535. | |
Protocol | string | No | The protocol of the init container. Valid values: TCP and UDP. | TCP |
Port | integer | No | The port number of the init container. Valid values: 1 to 65535. | 9000 |
SecurityContext.ReadOnlyRootFilesystem | boolean | No | Specifies whether the root file system is read-only. Set the value to true. | true |
EnvironmentVar | object [] | No | The environment variables for the init container. | |
Key | string | No | The name of the environment variable for the init container. | PATH |
Value | string | No | The value of the environment variable for the init container. | /usr/local/bin |
FieldRef.FieldPath | string | No | The reference of the environment variable value. Set the value to status.podIP. | status.podIP |
ImagePullPolicy | string | No | The image pulling policy. | Onfailure |
StdinOnce | boolean | No | Whether the container runtime closes the stdin channel after the stdin channel has been opened by a sing attach. If stdin is true, the stdin stream remains open across multiple attach sessions. If StdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and receive data until the client disconnects. When the client disconnects, stdin is closed and remains closed until the container is restarted. | true |
Cpu | float | No | The number of vCPUs that you want to allocate to the init container. | 2.0 |
Tty | boolean | No | Specifies whether to enable interaction. Default value: false. If the command is a /bin/bash command, set the value to true. | true |
WorkingDir | string | No | The working directory of the init container. | /bin/local/ |
Command | array | No | The commands of the init container. | |
string | No | The commands of the init container. | /bin/sh sleep | |
Arg | array | No | The startup arguments of the init container. | |
string | No | The startup arguments of the init container. | 10 | |
SecurityContext.RunAsUser | long | No | The ID of the user who runs the init container. | 1000 |
Gpu | integer | No | The number of GPUs that you want to allocate to the init container. | 1 |
Memory | float | No | The size of memory that you want to allocate to the init container. | 4.0 |
Stdin | boolean | No | Specifies whether the init container allocates buffer resources to standard input streams when the init container is running. If you do not specify this parameter, an EOF error may occur when standard input streams in the init container are read. Default value: false. | false |
Name | string | No | The name of the init container. | init-nginx |
ImageRegistryCredential | object [] | No | The information about the credentials of the image repository. | |
Password | string | No | The password that is used to access the image repository. | yourpassword |
Server | string | No | The address of the image repository. This address does not contain | registry.cn-shanghai.aliyuncs.com/ecitest/nginx:alpine |
UserName | string | No | The username that is used to access the image repository. | yourname |
AcrRegistryInfo | object [] | No | The information about the Container Registry Enterprise Edition instance. | |
InstanceId | string | No | The ID of the Container Registry Enterprise Edition instance. | cri-nwj395hgf6f3**** |
InstanceName | string | No | The name of the Container Registry Enterprise Edition instance. | acr-test |
RegionId | string | No | The region ID of the Container Registry Enterprise Edition instance. | cn-beijing |
Domain | array | No | The domain names of the Container Registry Enterprise Edition instance. By default, all domain names of the instance are displayed. You can specify one or more domain names. Separate multiple domain names with commas (,). | |
string | No | The domain names of the Container Registry Enterprise Edition instance. By default, all domain names of the instance are displayed. You can specify one or more domain names. Separate multiple domain names with commas (,). | cn-beijing | |
UpdateType | string | No | The update type. Valid values:
Default value: RenewUpdate. | RenewUpdate |
Description
Container and InitContainer parameters The Container and InitContainer parameters support only full updates. After you update the InitContainer parameters, you must restart the elastic container instance. You can update the containers of an elastic container instance in one of the following ways:
- The elastic container instance contains both init and non-init containers, and you update only the init containers.
- The elastic container instance contains both init and non-init containers, and you update only the non-init containers.
- The elastic container instance contains both init and non-init containers, and you update both the init and non-init containers.
- The elastic container instance contains only non-init containers, and you update these non-init containers.
- The elastic container instance contains only non-init containers, and you add init containers.
- The elastic container instance contains only non-init containers, and you add init containers and update the non-init containers.
ImageRegistryCredentials
- ImageRegistryCredential parameters support only full updates.
- If only ImageRegistryCredential parameters are updated, and the new quantity for the ImageRegistryCredential parameters after the update is not greater than the original number, you do not need to restart the elastic container instance. Otherwise, you must restart the elastic container instance.
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "CB8D2B22-D636-4182-****-1FC9DBDAD66F"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | InvalidParameter.CPU.Memory | The specified cpu and memory are not allowed | - |
400 | InvalidParameter.DuplicatedName | The container group include containers with duplicate names. | - |
400 | InvalidParameter.DuplicatedVolumeName | The container group includes volumes with duplicate names. | The container group includes volumes with duplicate names. |
400 | InvalidParameter.LengthExceeded | %s | - |
400 | InvalidParameter.ValueExceeded | %s | - |
400 | IncorrectStatus | %s | - |
400 | InvalidParam.CpuOrMemorySpec | The specified specification is invalid. | The specified specification is invalid. |
400 | InvalidParameter | %s | - |
400 | MissingParameter | %s | - |
400 | NoNeedUpdate | There are no changes to be updated for current resource. | There are no changes to be updated for current resource. |
403 | InvalidAction | The specified action is invalid | Invalid operation. |
404 | InvalidParameter.NotFound | %s | - |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2022-03-01 | The error codes of the API operation change.,The input parameters of the API operation change. | see changesets | ||||||||||||
|