All Products
Search
Document Center

Elastic Container Instance:UpdateContainerGroup

更新時間:Jul 22, 2024

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

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region ID of the instance.

cn-hangzhou
ContainerGroupIdstringYes

The ID of the elastic container instance that you want to update.

eci-2zelg8vwnlzdhf8hv****
RestartPolicystringNo

The restart policy of the elastic container instance. Valid values:

  • Always: Always restarts the instance if a container in the instance exits upon termination.
  • Never: Never restarts the instance if a container in the instance exits upon termination.
  • OnFailure: Restarts the instance only if a container in the instance exists upon failure with a status code of non-zero.
Always
ClientTokenstringNo

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
CpufloatNo

The number of vCPUs that are allocated to the elastic container instance.

2.0
MemoryfloatNo

The size of the memory that is allocated to the elastic container instance. Unit: GiB.

4.0
ResourceGroupIdstringNo

The ID of the resource group.

rg-2df3isufhi38****
Tagarray<object>No

The tags that are bound to the instance.

objectNo

The tags that are bound to the instance.

KeystringNo

The tag key.

name
ValuestringNo

The tag value.

hxh
Volumearray<object>No

The volumes that are mounted to the instance.

objectNo

The volumes that are mounted to the instance.

NamestringNo

The volume name.

test-empty
TypestringNo

The type of the HostPath volume. Valid values:

  • Directory
  • File
Note This parameter is not publicly available.
EmptyDirVolume
NFSVolume.PathstringNo

The path for mounting the NFS volume.

/
NFSVolume.ServerstringNo

The endpoint of the mount target of the NFS volume.

071e349b04-bsd39.cn-hangzhou.nas.aliyuncs.com
NFSVolume.ReadOnlybooleanNo

Specifies whether the permissions on the NFS volume are read-only. Valid values:

  • true: The permissions on the NFS volume are read-only.
  • true: The permissions on the NFS volume are read and write.
false
ConfigFileVolume.ConfigFileToPatharray<object>No

The information about the configuration file of the ConfigFile volume.

objectNo

The information about the configuration file of the ConfigFile volume.

PathstringNo

The relative path of the configuration file.

jin/test
ContentstringNo

The content of the configuration file. The value is Base64-encoded.

bGl1bWk=
EmptyDirVolume.MediumstringNo

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.SizeLimitstringNo

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.FsTypestringNo

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.DriverstringNo

The driver type when you use the FlexVolume plug-in to mount a volume. Valid values:

  • alicloud/disk: a disk driver.
  • alicloud/nas: a NAS driver.
  • alicloud/oss: an OSS driver.
alicloud/disk
FlexVolume.OptionsstringNo

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.PathstringNo

The path of the HostPath volume on the host.

Note This parameter is not publicly available.
/tmp
HostPathVolume.TypestringNo

The type of the HostPath volume. Valid values:

  • Directory
  • File
Note This parameter is not publicly available.
Directory
DnsConfig.SearcharrayNo

The search domains of the Domain Name System (DNS) server.

stringNo

The search domain of the DNS server.

my.dns.search.suffix
DnsConfig.NameServerarrayNo

The IP addresses of DNS servers.

stringNo

The IP address of the DNS server.

1.2.3.4
DnsConfig.Optionarray<object>No

The configurations of DNS.

objectNo

The configurations of DNS.

ValuestringNo

The option value of DNS configurations.

2
NamestringNo

The option name of DNS configurations.

ndots
Containerarray<object>No

The new configurations of the container group.

objectNo

The new configurations of the container group.

ReadinessProbe.TimeoutSecondsintegerNo

The period of time after which the probe times out. Unit: seconds. Default value: 1. Minimum value: 1.

5
ReadinessProbe.SuccessThresholdintegerNo

The minimum number of consecutive successes that must occur for the check to be considered successful. Default value: 1.

1
SecurityContext.Capability.AddarrayNo

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.
stringNo

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.PortintegerNo

The port to which the system sends a TCP socket request for a health check.

5000
ReadinessProbe.HttpGet.SchemestringNo

The protocol type of HTTP GET requests when you use HTTP requests to perform health checks. Valid values:

  • HTTP
  • HTTPS
HTTP
LivenessProbe.PeriodSecondsintegerNo

The interval at which the health check is performed. Unit: seconds. Default value: 10. Minimum value: 1.

10
SecurityContext.ReadOnlyRootFilesystembooleanNo

Specifies whether permissions on the root file system are read-only. Set the value to true.

true
EnvironmentVararray<object>No

The environment variables for the container.

objectNo

The environment variables for the container.

KeystringNo

The name of the environment variable for the container.

PATH
ValuestringNo

The value of the environment variable for the container.

/usr/bin/local/
FieldRef.FieldPathstringNo

The pod field that is used as the environment variable for the container. Set the value to status.podIP.

status.podIP
LivenessProbe.TcpSocket.PortintegerNo

The port to which the system sends a TCP socket request for a health check.

80
TtybooleanNo

Specifies whether to enable interaction. Default value: false. If the command is a /bin/bash command, set the value to true.

false
WorkingDirstringNo

The working directory of the container.

/usr/share/
ArgarrayNo

The arguments that you want to pass to the startup command of the container. You can specify up to 10 arguments.

stringNo

An argument that you want to pass to the startup command of the container.

hello
StdinbooleanNo

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.InitialDelaySecondsintegerNo

The number of seconds between the time when the startup of the container ends and the time when the probe starts.

10
VolumeMountarray<object>No

Pod volumes that you want to mount into the filesystem of the container.

objectNo

Pod volumes to mount into the filesystem of the container.

MountPropagationstringNo

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:

  • None: This volume mount does not receive subsequent mounts that are performed on this volume or subdirectories of this volume.
  • HostToCotainer: The volume mount receives subsequent mounts that are performed on this volume or the subdirectories of this volume.
  • Bidirectional: The volume mount behaves the same as the HostToContainer mount. The volume mount receives subsequent mounts that are performed on the volume or the subdirectories of the volume. In addition, all volume mounts that are mounted on the container are propagated back to the host and all containers of all pods that use the same volume.

Default value: None.

None
MountPathstringNo

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/
ReadOnlybooleanNo

Specifies whether the volume is read-only. Default value: false.

false
SubPathstringNo

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/
NamestringNo

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
ImagePullPolicystringNo

The image pulling policy. Valid values:

  • Always: Each time the instance is updated, image pulling is performed.
  • IfNotPresent: On-premises images are used first. If no on-premises images are available, image pulling is performed.
  • Never: On-premises images are always used. Image pulling is not performed.
Never
StdinOncebooleanNo

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
LifecyclePreStopHandlerTcpSocketPortintegerNo

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
LifecyclePostStartHandlerHttpGetSchemestringNo

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.PeriodSecondsintegerNo

The interval at which the health check is performed. Unit: seconds. Default value: 10. Minimum value: 1.

3
LivenessProbe.SuccessThresholdintegerNo

The minimum number of consecutive successes that must occur for the check to be considered successful. Set the value to 1.

1
CommandarrayNo

The commands that you want to run to perform the health check.

stringNo

A command that you want to run to perform the health check.

echo
LifecyclePostStartHandlerHttpGetHoststringNo

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.PathstringNo

The path to which the system sends an HTTP GET request for a health check.

/usr/
LivenessProbe.Exec.CommandarrayNo

The commands that are used to perform health checks on the container.

stringNo

A command that is used to perform a heath check on the container.

echo
LifecyclePostStartHandlerTcpSocketPortintegerNo

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
LifecyclePostStartHandlerHttpGetPathstringNo

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
LifecyclePostStartHandlerExecarrayNo

The commands to be executed in the container when you use the CLI to specify the postStart callback function.

stringNo

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"]
LifecyclePreStopHandlerHttpGetPathstringNo

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
Portarray<object>No

The port to which the system sends an HTTP GET request for a health check.

objectNo

The port number of the container. Valid values: 1 to 65535.

ProtocolstringNo

The protocol of the container. Valid values: TCP and UDP.

TCP
PortintegerNo

The port number. Valid values: 1 to 65535.

8080
LifecyclePreStopHandlerHttpGetSchemestringNo

The protocol type of the HTTP GET request when you use an HTTP request to specify the preStop callback function. Valid values:

  • HTTP
  • HTTPS
HTTP
LivenessProbe.HttpGet.SchemestringNo

The protocol type of HTTP GET requests when you use HTTP requests to perform health checks. Valid values:

  • HTTP
  • HTTPS
HTTP
LifecyclePostStartHandlerHttpGetHttpHeadersarray<object>No

The information about the valid HTTP request headers among the generated HTTP request headers.

objectNo

The information about the valid HTTP request headers among the generated HTTP request headers.

ValuestringNo

The request parameter value of the HTTP GET request when you use an HTTP request to specify the postStart callback function.

test
NamestringNo

The request parameter of the HTTP GET request when you use an HTTP request to specify the postStart callback function.

testValue
ReadinessProbe.HttpGet.PortintegerNo

The port to which the system sends an HTTP GET request for a health check.

8080
LifecyclePostStartHandlerTcpSocketHoststringNo

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
GpuintegerNo

The number of GPUs that you want to allocate to the container.

1
ReadinessProbe.InitialDelaySecondsintegerNo

The number of seconds between the time when the startup of the container ends and the time when the probe starts.

10
LifecyclePreStopHandlerExecarrayNo

The commands to be executed in the container when you use the CLI to specify the preStop callback function.

stringNo

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"]
MemoryfloatNo

The memory size of the container.

2.0
NamestringNo

The name of the container.

jenkins
LifecyclePreStopHandlerHttpGetHoststringNo

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
LifecyclePreStopHandlerTcpSocketHoststringNo

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
ImagestringNo

The image of the container.

jenkins
LifecyclePreStopHandlerHttpGetPortintegerNo

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.FailureThresholdintegerNo

The minimum number of consecutive failures that must occur for the check to be considered failed. Default value: 3.

3
ReadinessProbe.Exec.CommandarrayNo

The commands that you want to run to perform the health check.

stringNo

A command that you want to run to perform the health check.

echo
LifecyclePreStopHandlerHttpGetHttpHeaderarray<object>No

The information about the generated HTTP request header.

objectNo

The information about the generated HTTP request headers.

ValuestringNo

The request parameter value of the HTTP GET request when you use an HTTP request to specify the preStop callback function.

testValue
NamestringNo

The request parameter of the HTTP GET request when you use an HTTP request to specify the preStop callback function.

test
ReadinessProbe.FailureThresholdintegerNo

The minimum number of consecutive failures that must occur for the check to be considered failed. Default value: 3.

3
CpufloatNo

The number of vCPUs that you want to allocate to the container

1.0
LivenessProbe.HttpGet.PortintegerNo

The port to which the system sends an HTTP GET request for a health check.

8080
LivenessProbe.HttpGet.PathstringNo

The path to which the system sends an HTTP GET request for a health check.

/usr/local/bin
LivenessProbe.TimeoutSecondsintegerNo

The period of time after which the probe times out. Unit: seconds. Default value: 1. Minimum value: 1.

1
SecurityContext.RunAsUserlongNo

The user ID (UID) that is used to run the entry point of the container process.

1377
LifecyclePostStartHandlerHttpGetPortintegerNo

The port to which the system sends the HTTP GET request when you use an HTTP request to specify the postStart callback function.

1
InitContainerarray<object>No

The information about the new init container.

objectNo

The information about the new init containers.

SecurityContext.Capability.AddarrayNo

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.
stringNo

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
ImagestringNo

The image of the init container.

nginx
VolumeMountarray<object>No

The information about the volume that you want to mount on the init container.

objectNo

Pod volumes to mount into the filesystem of the init container.

MountPropagationstringNo

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:

  • None: The volume mount does not receive subsequent mounts that are performed on this volume or subdirectories of this volume.
  • HostToContainer: The volume mount receives all subsequent mounts that are performed on this volume or subdirectories of this volume.
  • Bidirectional: The volume mount behaves the same as the HostToContainer mount. The volume mount receives subsequent mounts that are performed on the volume or the subdirectories of the volume. In addition, all volume mounts that are mounted on the container are propagated back to the host and all containers of all pods that use the same volume.

Default value: None.

None
MountPathstringNo

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
ReadOnlybooleanNo

Specifies whether the volume is read-only. Default value: false.

false
SubPathstringNo

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/
NamestringNo

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
Portarray<object>No

The port number. Valid values: 1 to 65535.

objectNo

The port number. Valid values: 1 to 65535.

ProtocolstringNo

The protocol of the init container. Valid values: TCP and UDP.

TCP
PortintegerNo

The port number of the init container. Valid values: 1 to 65535.

9000
SecurityContext.ReadOnlyRootFilesystembooleanNo

Specifies whether the root file system on which the init container runs is read-only. Set the value to true.

true
EnvironmentVararray<object>No

The environment variable of the init container.

objectNo

The environment variables for the init container.

KeystringNo

The name of the environment variable for the init container.

PATH
ValuestringNo

The value of the environment variable for the init container.

/usr/local/bin
FieldRef.FieldPathstringNo

The reference of the environment variable value. Set the value to status.podIP.

status.podIP
ImagePullPolicystringNo

The image pulling policy. Valid values:

  • Always: Each time the instance is updated, image pulling is performed.
  • IfNotPresent: On-premises images are used first. If no on-premises images are available, image pulling is performed.
  • Never: On-premises images are always used. Image pulling is not performed.
Onfailure
StdinOncebooleanNo

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
CpufloatNo

The number of vCPUs that you want to allocate to the init container.

2.0
TtybooleanNo

Specifies whether to enable interaction. Default value: false. If the command is a /bin/bash command, set the value to true.

true
WorkingDirstringNo

The working directory of the init container.

/bin/local/
CommandarrayNo

The commands that are used to start the init container.

stringNo

A command that is used to start the init container.

/bin/sh sleep
ArgarrayNo

The arguments that you want to pass to the startup command of the init container.

stringNo

An argument that you want to pass to the startup command of the init container.

10
SecurityContext.RunAsUserlongNo

The UID that is used to run the init container.

1000
GpuintegerNo

The number of GPUs you want to allocate to the init container.

1
MemoryfloatNo

The memory size of the init container.

4.0
StdinbooleanNo

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
NamestringNo

The name of the init container.

init-nginx
ImageRegistryCredentialarray<object>No

The information about the credentials of the image repository.

objectNo

The information about the credentials of the image repository.

PasswordstringNo

The password that you use to access the image repository.

yourpassword
ServerstringNo

The address of the image repository. This address does not contain http:// or https://.

registry.cn-shanghai.aliyuncs.com/ecitest/nginx:alpine
UserNamestringNo

The username that you use to access the image repository.

yourname
AcrRegistryInfoarray<object>No

Details of the Container Registry Enterprise Edition instance that hosts the image of the init container.

objectNo

The information about the Container Registry Enterprise Edition instance.

InstanceIdstringNo

The ID of the Container Registry Enterprise Edition instance.

cri-nwj395hgf6f3****
InstanceNamestringNo

The name of the Container Registry Enterprise Edition instance.

acr-test
RegionIdstringNo

The ID of the region where the Container Registry Enterprise Edition instance resides.

cn-beijing
DomainarrayNo

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 (,).

stringNo

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
UpdateTypestringNo

The update type. Valid values:

  • RenewUpdate: full updates. You must specify all relevant parameters to update the elastic container instance. For a parameter of the list type, you must specify all the items contained in the parameter even if you want to update only some of the items. For a parameter of the struct type, you must specify all the members even if you want to update only some of the members.
  • IncrementalUpdate: incremental updates. You may specify only the parameter that you want to update. Other related parameters remain unchanged.

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.
Note RenewUpdate: For a parameter of the list type, you must specify all the items contained in the parameter even if you want to update only some of the items. For a parameter of the struct type, you must specify all the members even if you want to update only some of the members.

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The request ID.

CB8D2B22-D636-4182-****-1FC9DBDAD66F

Examples

Sample success responses

JSONformat

{
  "RequestId": "CB8D2B22-D636-4182-****-1FC9DBDAD66F"
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidParameter.CPU.MemoryThe specified cpu and memory are not allowed-
400InvalidParameter.DuplicatedNameThe container group include containers with duplicate names.-
400InvalidParameter.DuplicatedVolumeNameThe container group includes volumes with duplicate names.The container group includes volumes with duplicate names.
400InvalidParameter.LengthExceeded%s-
400InvalidParameter.ValueExceeded%s-
400IncorrectStatus%s-
400InvalidParam.CpuOrMemorySpecThe specified specification is invalid.The specified specification is invalid.
400InvalidParameter%s-
400MissingParameter%s-
400NoNeedUpdateThere are no changes to be updated for current resource.There are no changes to be updated for current resource.
403InvalidActionThe specified action is invalidInvalid operation.
404InvalidParameter.NotFound%s-

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2022-03-01The Error code has changed. The request parameters of the API has changedView Change Details