All Products
Search
Document Center

Elastic Container Instance:UpdateContainerGroup

Last Updated:Nov 14, 2023

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

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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.
OperationAccess levelResource typeCondition keyAssociated operation
eci:UpdateContainerGroupWRITE
  • containergroup
    acs:eci:{#regionId}:{#accountId}:containergroup/{#containergroupId}
  • eci:tag
none

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 allocated to the elastic container instance.

2.0
MemoryfloatNo

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

4.0
ResourceGroupIdstringNo

The ID of the resource group.

rg-2df3isufhi38****
Tagobject []No

The tags that are bound to the instance.

KeystringNo

The key of the tag.

name
ValuestringNo

The value of the tag.

hxh
Volumeobject []No

The volumes that are mounted to the instance.

NamestringNo

The name of the volume.

test-empty
TypestringNo

The type of the HostPath volume. Valid values:

  • Directory
  • File
Note This parameter is unavailable.
EmptyDirVolume
NFSVolume.PathstringNo

The path to mount the NFS volume.

/
NFSVolume.ServerstringNo

The domain name 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.
  • false: The permissions on the NFS volume are read and write.
false
ConfigFileVolume.ConfigFileToPathobject []No

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 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.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: mounts a disk.
  • alicloud/nas: mounts a NAS file system.
  • alicloud/oss: mounts an OSS bucket.
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 unavailable.
/tmp
DnsConfig.SearcharrayNo

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

stringNo

The search domains of the DNS server.

my.dns.search.suffix
DnsConfig.NameServerarrayNo

The IP addresses of the DNS servers.

stringNo

The IP addresses of the DNS servers.

1.2.3.4
DnsConfig.Optionobject []No

The configurations of DNS.

ValuestringNo

The option value of DNS configurations.

2
NamestringNo

The option name of DNS configurations.

ndots
Containerobject []No

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 granted to processes in the container. Valid values: NET_ADMIN and NET_RAW.

Note To use NET_RAW, you must submit a ticket.
stringNo

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.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 probe is run. 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
EnvironmentVarobject []No

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
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 are passed to the container startup command. You can specify up to 10 arguments.

stringNo

The arguments that are passed to the container startup command.

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
VolumeMountobject []No

Pod volumes to mount into the filesystem of the container.

MountPropagationstringNo

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:

  • None: This volume mount does not receive subsequent mounts that are mounted to this volume or subdirectories of this volume by the host.
  • HostToCotainer: This volume mount receives all subsequent mounts that are mounted to this volume or subdirectories of this volume.
  • Bidirectional: The volume mount behaves the same as the HostToCotainer mount. The volume mount receives all subsequent mounts that are mounted to this volume or subdirectories of this volume. In addition, all volume mounts created by the container are propagated back to the host and to 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. The pod can mount different directories of the same volume to different subdirectories of containers.

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

Never
StdinOncebooleanNo

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
LifecyclePreStopHandlerTcpSocketPortintegerNo

The port of TCP socket probes when you use TCP sockets to specify the preStop callback function.

80
LifecyclePostStartHandlerHttpGetSchemestringNo

The path to which HTTP GET requests are sent when you use HTTP requests to specify the postStart callback function.

/healthyz
ReadinessProbe.PeriodSecondsintegerNo

The interval at which the container is checked. Unit: seconds. Default value: 10. Minimum value: 1.

3
LivenessProbe.SuccessThresholdintegerNo

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

1
CommandarrayNo

The commands that are used to run the probe.

stringNo

The commands that are used to run the probe.

echo
LifecyclePostStartHandlerHttpGetHoststringNo

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

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

/usr/
LifecyclePostStartHandlerTcpSocketPortintegerNo

The port of TCP socket probes when you use TCP sockets to specify the postStart callback function.

1
LifecyclePostStartHandlerHttpGetPathstringNo

The path to which HTTP GET requests are sent when you use HTTP requests to specify the postStart callback function.

/healthyz
LifecyclePostStartHandlerExecarrayNo

The command that you run in the container when you use a command-line interface (CLI) to specify the postStart callback function.

stringNo

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

The path to which HTTP GET requests are sent when you use HTTP requests to specify the preStop callback function.

/healthyz
Portobject []No

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

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 HTTP GET requests when you use HTTP requests 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
LifecyclePostStartHandlerHttpGetHttpHeadersobject []No

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

ValuestringNo

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

test
NamestringNo

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

testValue
LifecyclePostStartHandlerTcpSocketHoststringNo

The host IP address of TCP socket probes when you use TCP sockets 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 check starts.

10
LifecyclePreStopHandlerExecarrayNo

The command that you run in the container when you use a CLI to specify the preStop callback function.

stringNo

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"]
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 HTTP GET requests when you use HTTP requests to specify the preStop callback function.

10.0.XX.XX
LifecyclePreStopHandlerTcpSocketHoststringNo

The host IP address of TCP socket probes when you use TCP sockets to specify the preStop callback function.

10.0.XX.XX
ImagestringNo

The image of the container.

jenkins
LifecyclePreStopHandlerHttpGetPortintegerNo

The port to which HTTP GET requests are sent when you use HTTP requests to specify the preStop callback function.

1
LivenessProbe.FailureThresholdintegerNo

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

3
LifecyclePreStopHandlerHttpGetHttpHeaderobject []No

The information about the generated HTTP request headers.

ValuestringNo

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

testValue
NamestringNo

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

test
ReadinessProbe.FailureThresholdintegerNo

The minimum number of consecutive failures that must occur for the probe 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.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 HTTP GET requests are sent when you use HTTP requests to specify the postStart callback function.

1
InitContainerobject []No

The information about the new init containers.

SecurityContext.Capability.AddarrayNo

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

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
ImagestringNo

The image of the init container.

nginx
VolumeMountobject []No

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

MountPropagationstringNo

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:

  • None: This volume mount does not receive subsequent mounts that are mounted to this volume or subdirectories of this volume by the host.
  • HostToCotainer: This volume mount receives all subsequent mounts that are mounted to this volume or subdirectories of this volume.
  • Bidirectional: The volume mount behaves the same as the HostToCotainer mount. The volume mount receives all subsequent mounts that are mounted to this volume or subdirectories of this volume. In addition, all volume mounts created by the container are propagated back to the host and to 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 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. The pod can mount different directories of the same volume to different subdirectories of init containers.

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
Portobject []No

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 is read-only. Set the value to true.

true
EnvironmentVarobject []No

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.

Onfailure
StdinOncebooleanNo

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
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 of the init container.

stringNo

The commands of the init container.

/bin/sh sleep
ArgarrayNo

The startup arguments of the init container.

stringNo

The startup arguments of the init container.

10
SecurityContext.RunAsUserlongNo

The ID of the user who runs the init container.

1000
GpuintegerNo

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

1
MemoryfloatNo

The size of memory that you want to allocate to 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
ImageRegistryCredentialobject []No

The information about the credentials of the image repository.

PasswordstringNo

The password that is used 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 is used to access the image repository.

yourname
AcrRegistryInfoobject []No

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 region ID of the Container Registry Enterprise Edition instance.

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 one or more domain names. Separate multiple domain names with commas (,).

stringNo

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
UpdateTypestringNo

The update type. Valid values:

  • RenewUpdate: full update. You must specify all relevant parameters to update the 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 if you want to update only some of the members.
  • IncrementalUpdate: incremental update. You can specify only the parameter that needs to be updated. Other related parameters remain unchanged.

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.
Note Full update: For a parameter of the List type, you must specify all the items contained in the parameter value 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 ID of the request.

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 codes of the API operation change.,The input parameters of the API operation change.see changesets
Change itemChange content
Error CodesThe error codes of the API operation change.
    delete Error Codes: 400
    delete Error Codes: 403
    delete Error Codes: 404
Input ParametersThe input parameters of the API operation change.
    Added Input Parameters: UpdateType