Updates an elastic container instance.
Operation description
- Only elastic container instances that are in the Pending or Running state can be updated. After you call this operation to update an elastic container instance, the instance enters the Updating state.
- If the RestartPolicy parameter is set to Never for the elastic container instance that you are updating, the containers of the instance may fail. Exercise caution if you want to update the kind of instances.
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 | update | *containergroup acs:eci:{#regionId}:{#accountId}:containergroup/{#containergroupId} |
| 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 that are allocated to the elastic container instance. | 2.0 |
Memory | float | No | The size of the memory that is allocated to the elastic container instance. Unit: GiB. | 4.0 |
ResourceGroupId | string | No | The ID of the resource group. | rg-2df3isufhi38**** |
Tag | array<object> | No | The tags that are bound to the instance. | |
object | No | The tags that are bound to the instance. | ||
Key | string | No | The tag key. | name |
Value | string | No | The tag value. | hxh |
Volume | array<object> | No | The volumes that are mounted to the instance. | |
object | No | The volumes that are mounted to the instance. | ||
Name | string | No | The volume name. | test-empty |
Type | string | No | The type of the HostPath volume. Valid values:
Note
This parameter is not publicly available.
| EmptyDirVolume |
NFSVolume.Path | string | No | The path for mounting the NFS volume. | / |
NFSVolume.Server | string | No | The endpoint 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 | array<object> | No | The information about the configuration file of the ConfigFile volume. | |
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 the emptyDir volume. This parameter is empty by default. In this case, the file system of the node 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 not publicly available.
| /tmp |
HostPathVolume.Type | string | No | The type of the HostPath volume. Valid values:
Note
This parameter is not publicly available.
| Directory |
DnsConfig.Search | array | No | The search domains of the Domain Name System (DNS) server. | |
string | No | The search domain of the DNS server. | my.dns.search.suffix | |
DnsConfig.NameServer | array | No | The IP addresses of DNS servers. | |
string | No | The IP address of the DNS server. | 1.2.3.4 | |
DnsConfig.Option | array<object> | No | The configurations of DNS. | |
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 | array<object> | No | The new configurations of the container group. | |
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 that you want to grant to the processes in the container. Valid values: NET_ADMIN and NET_RAW. Note
To use the NET_RAW value, you must submit a ticket.
| |
string | No | The permissions that you want to grant to the processes in the container. Valid values: NET_ADMIN and NET_RAW. Note
To use the NET_RAW value, you must submit a ticket.
| NET_ADMIN | |
ReadinessProbe.TcpSocket.Port | integer | No | The port to which the system sends a TCP socket request for a health check. | 5000 |
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 health check is performed. 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 | array<object> | No | The environment variables for the container. | |
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 |
LivenessProbe.TcpSocket.Port | integer | No | The port to which the system sends a TCP socket request for a health check. | 80 |
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 you want to pass to the startup command of the container. You can specify up to 10 arguments. | |
string | No | An argument that you want to pass to the startup command of the container. | 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 | array<object> | No | Pod volumes that you want to mount into the filesystem of the container. | |
object | No | Pod volumes to mount into the filesystem of the container. | ||
MountPropagation | string | No | The mount propagation settings 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. You can use this parameter to mount the same volume to different subdirectories of the container. | /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. Valid values:
| Never |
StdinOnce | boolean | No | Specifies whether standard input streams are disconnected after a client is disconnected. If Stdin is set to true, standard input streams remain connected among multiple sessions. If StdinOnce is set to true, standard input streams are connected after the container is started, and remain idle until a client is connected to receive data. After the client is disconnected, streams are also disconnected, and remain disconnected until the container restarts. | true |
LifecyclePreStopHandlerTcpSocketPort | integer | No | The port to which the system sends a TCP socket request for a health check when you use TCP sockets to specify the preStop callback function. | 80 |
LifecyclePostStartHandlerHttpGetScheme | string | No | The path to which the system sends an HTTP GET request for a health check when you use an HTTP request to specify the postStart callback function. | /healthyz |
ReadinessProbe.PeriodSeconds | integer | No | The interval at which the health check is performed. Unit: seconds. Default value: 10. Minimum value: 1. | 3 |
LivenessProbe.SuccessThreshold | integer | No | The minimum number of consecutive successes that must occur for the check to be considered successful. Set the value to 1. | 1 |
Command | array | No | The commands that you want to run to perform the health check. | |
string | No | A command that you want to run to perform the health check. | echo | |
LifecyclePostStartHandlerHttpGetHost | string | No | The IP address of the host that receives the HTTP GET request when you use an HTTP request 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/ |
LivenessProbe.Exec.Command | array | No | The commands that are used to perform health checks on the container. | |
string | No | A command that is used to perform a heath check on the container. | echo | |
LifecyclePostStartHandlerTcpSocketPort | integer | No | The port to which the system sends a TCP socket request for a health check when you use TCP sockets to specify the postStart callback function. | 1 |
LifecyclePostStartHandlerHttpGetPath | string | No | The path to which the system sends an HTTP GET request for a health check when you use an HTTP request to specify the postStart callback function. | /healthyz |
LifecyclePostStartHandlerExec | array | No | The commands to be executed in the container when you use the CLI to specify the postStart callback function. | |
string | No | The command to be executed in the container when you use the 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 the system sends an HTTP GET request for a health check when you use an HTTP request to specify the preSop callback function. | /healthyz |
Port | array<object> | No | The port to which the system sends an HTTP GET request for a health check. | |
object | No | The port number of the container. Valid values: 1 to 65535. | ||
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 the HTTP GET request when you use an HTTP request 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 | array<object> | No | The information about the valid HTTP request headers among the generated HTTP request headers. | |
object | No | The information about the valid HTTP request headers among the generated HTTP request headers. | ||
Value | string | No | The request parameter value of the HTTP GET request when you use an HTTP request to specify the postStart callback function. | test |
Name | string | No | The request parameter of the HTTP GET request when you use an HTTP request to specify the postStart callback function. | testValue |
ReadinessProbe.HttpGet.Port | integer | No | The port to which the system sends an HTTP GET request for a health check. | 8080 |
LifecyclePostStartHandlerTcpSocketHost | string | No | The IP address of the host that receives the TCP socket request when you use a TCP socket request 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 probe starts. | 10 |
LifecyclePreStopHandlerExec | array | No | The commands to be executed in the container when you use the CLI to specify the preStop callback function. | |
string | No | The command to be executed in the container when you use the 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 the HTTP GET request when you use an HTTP request to specify the preStop callback function. | 10.0.XX.XX |
LifecyclePreStopHandlerTcpSocketHost | string | No | The IP address of the host that receives the TCP socket request when you use a TCP socket request 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 the system sends the HTTP GET request for a health check when you use an HTTP request to specify the preStop callback function. | 1 |
LivenessProbe.FailureThreshold | integer | No | The minimum number of consecutive failures that must occur for the check to be considered failed. Default value: 3. | 3 |
ReadinessProbe.Exec.Command | array | No | The commands that you want to run to perform the health check. | |
string | No | A command that you want to run to perform the health check. | echo | |
LifecyclePreStopHandlerHttpGetHttpHeader | array<object> | No | The information about the generated HTTP request header. | |
object | No | The information about the generated HTTP request headers. | ||
Value | string | No | The request parameter value of the HTTP GET request when you use an HTTP request to specify the preStop callback function. | testValue |
Name | string | No | The request parameter of the HTTP GET request when you use an HTTP request to specify the preStop callback function. | test |
ReadinessProbe.FailureThreshold | integer | No | The minimum number of consecutive failures that must occur for the check 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.Port | integer | No | The port to which the system sends an HTTP GET request for a health check. | 8080 |
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 the system sends the HTTP GET request when you use an HTTP request to specify the postStart callback function. | 1 |
InitContainer | array<object> | No | The information about the new init container. | |
object | No | The information about the new init containers. | ||
SecurityContext.Capability.Add | array | No | The permissions that you want to grant to the processes in the init container. Valid values: NET_ADMIN and NET_RAW. Note
To use the NET_RAW value, you must submit a ticket.
| |
string | No | The permissions that you want to grant to the processes in the init container. Valid values: NET_ADMIN and NET_RAW. Note
To use the NET_RAW value, you must submit a ticket.
| NET_ADMIN | |
Image | string | No | The image of the init container. | nginx |
VolumeMount | array<object> | No | The information about the volume that you want to mount on the init container. | |
object | No | Pod volumes to mount into the filesystem of the init container. | ||
MountPropagation | string | No | The mount propagation settings 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 mount directory of 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. You can use this parameter to mount the same volume to different subdirectories of the init container. | 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 | array<object> | No | The port number. Valid values: 1 to 65535. | |
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 on which the init container runs is read-only. Set the value to true. | true |
EnvironmentVar | array<object> | No | The environment variable of the init container. | |
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. Valid values:
| Onfailure |
StdinOnce | boolean | No | Specifies whether standard input streams are disconnected after a client is disconnected. If Stdin is set to true, standard input streams remain connected among multiple sessions. If StdinOnce is set to true, standard input streams are connected after the init container is started, and remain idle until a client is connected to receive data. After the client is disconnected, streams are also disconnected, and remain disconnected until the init container restarts. | 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 that are used to start the init container. | |
string | No | A command that is used to start the init container. | /bin/sh sleep | |
Arg | array | No | The arguments that you want to pass to the startup command of the init container. | |
string | No | An argument that you want to pass to the startup command of the init container. | 10 | |
SecurityContext.RunAsUser | long | No | The UID that is used to run the init container. | 1000 |
Gpu | integer | No | The number of GPUs you want to allocate to the init container. | 1 |
Memory | float | No | The memory size of 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 | array<object> | No | The information about the credentials of the image repository. | |
object | No | The information about the credentials of the image repository. | ||
Password | string | No | The password that you use 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 you use to access the image repository. | yourname |
AcrRegistryInfo | array<object> | No | Details of the Container Registry Enterprise Edition instance that hosts the image of the init container. | |
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 ID of the region where the Container Registry Enterprise Edition instance resides. | 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 specific domain names. Separate multiple domain names with commas (,). | |
string | No | A domain name of the Container Registry Enterprise Edition instance. By default, all domain names of the instance are displayed. You can specify specific domain names. Separate multiple domain names with commas (,). | cn-beijing | |
UpdateType | string | No | The update type. Valid values:
Default value: RenewUpdate. | RenewUpdate |
Parameter 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 init and non-init containers, and you update 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 the RenewUpdate update type.
- If you only update ImageRegistryCredential parameters, and the new quantity for the ImageRegistryCredential parameters after the update is not greater than the original quantity, 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 code has changed. The request parameters of the API has changed | View Change Details |