You can call this operation to update an elastic container instance.

Description

  • You can update only elastic container instances that are in the Pending (Pending) or Running (Running) state. After you call this operation to update an elastic container instance, the instance enters the Updating (Updating) state.
  • The specifications of elastic container instances cannot be changed. The specifications of containers can be changed, and this change must not affect instance specifications.
  • You cannot update the elastic container instances that were created before 15:00:00 on March 7, 2019.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String No UpdateContainerGroup

The operation that you want to perform. Set the value to UpdateContainerGroup.

ContainerGroupId String Yes eci-2zelg8vwnlzdhf8hv****

The ID of the elastic container instance.

RegionId String Yes cn-hangzhou

The region ID of the elastic container instance.

RestartPolicy String No Always

The restart policy of the elastic container instance.

Tag.N.Key String No name

The key of the tag.

Tag.N.Value String No hxh

The value of the tag.

Volume.N.Name String No test-empty

The name of the volume.

Volume.N.Type String No EmptyDirVolume

The type of the volume. Valid values:

  • EmptyDirVolume
  • NFSVolume
  • ConfigFileVolume
Volume.N.NFSVolume.Server String No 0eaf24bfc1-xxxxx.cn-hangzhou.nas.aliyuncs.com

The endpoint of the Network File System (NFS) server.

Volume.N.NFSVolume.Path String No /

The path to the NFS volume.

Volume.N.NFSVolume.ReadOnly Boolean No false

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

Volume.N.ConfigFileVolume.ConfigFileToPath.N.Content String No bGl1bWk=

The content of the configuration file. The value can be up to 32 KB in size.

Volume.N.ConfigFileVolume.ConfigFileToPath.N.Path String No liu/name

The relative path to the configuration file.

Volume.N.EmptyDirVolume.Medium String No Memory

The storage medium of the emptyDir volume. This parameter is empty by default, which indicates that the emptyDir volume uses the file system on the node as a storage medium. You can also set the value to Memory, which indicates that the emptyDir volume uses memory as a storage medium.

DnsConfig.NameServer.N RepeatList No 1.2.3.4

The IP addresses of Domain Name System (DNS) servers.

DnsConfig.Search.N RepeatList No my.dns.search.suffix

The DNS lookup domains.

DnsConfig.Option.N.Name String No ndots

The name of the option.

DnsConfig.Option.N.Value String No 2

The value of the option.

Container.N.Name String No jenkins

The name of the container.

Container.N.Image String No jenkins

The image of the container.

Container.N.Cpu Float No 1.0

The number of vCPUs allocated to the container.

Container.N.Memory Float No 2.0

The amount of memory allocated to the container.

Container.N.WorkingDir String No /usr/share/

The working directory of the container.

Container.N.ImagePullPolicy String No Never

The image pulling policy of the container.

Container.N.Stdin Boolean No false

Specifies whether the container allocates buffer resources to standard input streams while the container is running. If this parameter is not specified, an end-of-file (EoF) error may occur. Default value: false.

Container.N.StdinOnce Boolean No true

Specifies whether standard input streams are disconnected after a client is disconnected. If Container.N.Stdin is set to true, standard input streams remain connected during multiple sessions. If Container.N.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, the streams are also disconnected and remain in the disconnected state until the container is started again.

Container.N.Tty Boolean No false

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

Container.N.Command.N RepeatList No echo

The startup commands of the container. You can specify up to 20 commands. Each command can be up to 256 characters in length.

Container.N.Arg.N RepeatList No hello

The startup arguments of the container. You can specify up to 10 arguments.

Container.N.EnvironmentVar.N.Key String No PATH

The name of the environment variable for the container.

Container.N.EnvironmentVar.N.Value String No /usr/bin/local/

The value of the environment variable for the container.

Container.N.EnvironmentVar.N.FieldRef.FieldPath String No status.podIP

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

Container.N.Port.N.Protocol String No TCP

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

Container.N.Port.N.Port Integer No 8080

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

Container.N.VolumeMount.N.Name String No test-empty

The name of the volume mounted to the container. Valid values: the Volume.N.Name values, which are the names of volumes mounted to the elastic container instance.

Container.N.VolumeMount.N.MountPath String No /usr/share/

The directory of the volume mounted to the container. Data under this directory will be overwritten by the data on the volume.

Container.N.VolumeMount.N.SubPath String No /usr/share/sub/

The subdirectory of the volume mounted to the container. The pod can mount different directories of the same volume to different subdirectories of containers.

Container.N.VolumeMount.N.ReadOnly Boolean No false

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

Container.N.VolumeMount.N.MountPropagation String No None

The mount propagation setting of the volume. Mount propagation allows the sharing of volumes mounted by one container to other containers in the same pod, or even to other pods on the same node. Valid values:

  • None: The volume mount does not receive subsequent mounts that are mounted to this volume or its subdirectories.
  • HostToCotainer: The volume mount receives all subsequent mounts that are mounted to this volume or its subdirectories.
  • Bidirectional: This value is similar to HostToCotainer. The volume mount receives all subsequent mounts that are mounted to this volume or its subdirectories. In addition, all volume mounts created by the container are propagated back to the instance and to all containers of all pods that use the same volume.

Default value: None.

Container.N.ReadinessProbe.TcpSocket.Port Integer No 5000

The port used for TCP socket probes.

Container.N.ReadinessProbe.Exec.Command.N RepeatList No [/bin/sh cat /tmp/healthy]

The command used to perform a readiness probe on the container.

Container.N.ReadinessProbe.HttpGet.Path String No /usr/

The path used to send an HTTP GET request for a readiness probe.

Container.N.ReadinessProbe.HttpGet.Port Integer No 8080

The port used to send an HTTP GET request for a readiness probe.

Container.N.ReadinessProbe.HttpGet.Scheme String No HTTP

The protocol used to send an HTTP GET request for a readiness probe. Valid values: HTTP and HTTPS.

Container.N.ReadinessProbe.InitialDelaySeconds Integer No 10

The start time of the readiness probe. Unit: seconds. The value is the number of seconds that elapse after the container is started. For example, if you set the value to 10, the readiness probe starts 10 seconds after the container is started.

Container.N.ReadinessProbe.PeriodSeconds Integer No 10

The period during which the readiness probe is performed. Unit: seconds. Default value: 10. Minimum value: 1.

Container.N.ReadinessProbe.SuccessThreshold Integer No 3

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

Container.N.ReadinessProbe.FailureThreshold Integer No 3

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

Container.N.ReadinessProbe.TimeoutSeconds Integer No 5

The timeout period of the readiness probe. Unit: seconds. Default value: 1. Minimum value: 1.

Container.N.LivenessProbe.TcpSocket.Port Integer No 80

The port used for TCP socket probes.

Container.N.LivenessProbe.Exec.Command.N RepeatList No [/bin/sh cat /tmp/healthy]

The command used to perform a liveness probe on the container.

Container.N.LivenessProbe.HttpGet.Path String No /usr/local/bin

The path used to send an HTTP GET request for a liveness probe.

Container.N.LivenessProbe.HttpGet.Port Integer No 8080

The port used to send an HTTP GET request for a liveness probe.

Container.N.LivenessProbe.HttpGet.Scheme String No HTTP

The protocol used to send an HTTP GET request for a liveness probe. Valid values: HTTP and HTTPS.

Container.N.LivenessProbe.InitialDelaySeconds Integer No 10

The start time of the liveness probe. Unit: seconds. The value is the number of seconds that elapse after the container is started. For example, if you set the value to 10, the liveness probe starts 10 seconds after the container is started.

Container.N.LivenessProbe.PeriodSeconds Integer No 10

The period during which the liveness probe is performed. Unit: seconds. Default value: 10. Minimum value: 1.

Container.N.LivenessProbe.SuccessThreshold Integer No 1

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

Container.N.LivenessProbe.FailureThreshold Integer No 3

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

Container.N.LivenessProbe.TimeoutSeconds Integer No 1

The timeout period of the liveness probe. Unit: seconds. Default value: 1. Minimum value: 1.

Container.N.SecurityContext.ReadOnlyRootFilesystem Boolean No true

Specifies whether to mount the root file system in read-only mode. Set the value to true.

Container.N.SecurityContext.RunAsUser Long No 1337

The user ID (UID) used to run the entrypoint of the container process.

Container.N.SecurityContext.Capability.Add.N RepeatList No NET_ADMIN

The permission-related parameter included in capabilities. Set the value to NET_ADMIN.

Container.N.Gpu Integer No 1

The number of GPUs allocated to the container.

InitContainer.N.Name String No init-nginx

The name of the init container.

InitContainer.N.Image String No nginx

The image of the init container.

InitContainer.N.Cpu Float No 2.0

The number of CPUs allocated to the init container.

InitContainer.N.Memory Float No 4.0

The amount of memory allocated to the init container.

InitContainer.N.WorkingDir String No /bin/local/

The working directory of the init container.

InitContainer.N.ImagePullPolicy String No Onfailure

The image pulling policy of the init container.

InitContainer.N.Stdin Boolean No false

Specifies whether the init container allocates buffer resources to standard input streams while the container is running. If this parameter is not specified, an EoF error may occur. Default value: false.

InitContainer.N.StdinOnce Boolean No true

Specifies whether standard input streams are disconnected after a client is disconnected. If InitContainer.N.Stdin is set to true, standard input streams remain connected during multiple sessions. If InitContainer.N.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 in the disconnected state until the container is started again.

InitContainer.N.Tty Boolean No true

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

InitContainer.N.Command.N RepeatList No /bin/sh sleep

The startup commands of the init container.

InitContainer.N.Arg.N RepeatList No 10

The startup arguments of the init container.

InitContainer.N.EnvironmentVar.N.Key String No PATH

The name of the environment variable for the init container.

InitContainer.N.EnvironmentVar.N.Value String No /usr/local/bin

The value of the environment variable for the init container.

InitContainer.N.EnvironmentVar.N.FieldRef.FieldPath String No status.podIP

The pod field used as the environment variable for the init container.

InitContainer.N.Port.N.Port Integer No 9000

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

InitContainer.N.Port.N.Protocol String No TCP

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

InitContainer.N.VolumeMount.N.Name String No default-volume1

The name of the volume mounted to the init container. Valid values: the Volume.N.Name values, which are the names of volumes mounted to the elastic container instance.

InitContainer.N.VolumeMount.N.MountPath String No /pod/data

The directory of the volume mounted to the init container. Data under this directory will be overwritten by the data on the volume.

InitContainer.N.VolumeMount.N.SubPath String No data2/

The subdirectory of the volume mounted to the init container. The pod can mount different directories of the same volume to different subdirectories of containers.

InitContainer.N.VolumeMount.N.ReadOnly Boolean No false

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

InitContainer.N.VolumeMount.N.MountPropagation String No None

The mount propagation setting of the volume. Mount propagation allows the sharing of volumes mounted by one container to other containers in the same pod, or even to other pods on the same node. Valid values:

  • None: The volume mount does not receive subsequent mounts that are mounted to this volume or its subdirectories.
  • HostToCotainer: The volume mount receives all subsequent mounts that are mounted to this volume or its subdirectories.
  • Bidirectional: This value is similar to HostToCotainer. The volume mount receives all subsequent mounts that are mounted to this volume or its subdirectories. In addition, all volume mounts created by the container are propagated back to the instance and to all containers of all pods that use the same volume.

Default value: None.

InitContainer.N.SecurityContext.ReadOnlyRootFilesystem Boolean No true

Specifies whether to mount the root file system in read-only mode.

InitContainer.N.SecurityContext.RunAsUser Long No 1000

The UID used to run the entrypoint of the container process.

InitContainer.N.SecurityContext.Capability.Add.N RepeatList No NET_ADMIN

The permission-related parameter included in capabilities. Set the value to NET_ADMIN.

InitContainer.N.Gpu Integer No 1

The number of GPUs allocated to the init container.

ImageRegistryCredential.N.Server String No registry.cn-shanghai.aliyuncs.com/ecitest/nginx:alpine

The image repository address without http:// or https:// as prefix.

  • ImageRegistryCredential parameters support only full updates.
  • If only ImageRegistryCredential parameters are updated and the post-update number of ImageRegistryCredential parameters is not greater than the pre-update number, you do not need to restart the elastic container instance. In other cases, you must restart the instance.
ImageRegistryCredential.N.UserName String No yourname

The username that is used to log on to the image repository.

ImageRegistryCredential.N.Password String No yourpassword

The password that is used to log on to the image repository.

ClientToken String No 123e4567-e89b-12d3-a456-426655440000

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 it 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 idempotence.

Cpu Float No 2.0

The number of vCPUs allocated to the elastic container instance.

Memory Float No 4.0

The amount of memory allocated to the elastic container instance.

ResourceGroupId String No rg-2df3isufhi38****

The ID of the resource group to which the elastic container instance belongs.

Parameter description

Cpu and Memory parameters
  • By default, Elastic Container Instance calculates the vCPU and memory specifications of the elastic container instance based on the container specifications.
Container and InitContainer parameters

Container and InitContainer parameters supports only full updates. After you update 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.
Volume-related parameters

You must meet the same requirements when you update volume-related parameters as when you create elastic container instances.

  • Volume-related parameters support only full updates.
  • After you update volume-related parameters, you must restart the elastic container instance.
    Note Volumes are mounted to specific containers by volume name. When you update volumes, you can update only basic attributes of the volumes. To make other changes, such as adding, removing, or renaming volumes, we recommend that you update the containers at the same time.
ImageRegistryCredential parameters
  • ImageRegistryCredential parameters support only full updates.
  • If only ImageRegistryCredential parameters are updated and the post-update number of ImageRegistryCredential parameters is not greater than the pre-update number, you do not need to restart the elastic container instance. In other cases, you must restart the instance.
Tag parameters
  • Tag parameters support only full updates.
  • After you update Tag parameters, you do not need to restart the elastic container instance.
DnsConfig parameters
  • DnsConfig parameters support only full updates.
  • After you update DnsConfig parameters, 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 struct, you must specify all the members of the struct event if you want to update only some of the members.

Response parameters

Parameter Type Example Description
RequestId String CB8D2B22-D636-4182-****-1FC9DBDAD66F

The ID of the request.

Examples

Sample requests

https://eci.aliyuncs.com//?Action=UpdateContainerGroup
&ContainerGroupId=eci-2zelg8vwnlzdhf8hv****
&RegionId=cn-hangzhou
&<Common request parameters>

Sample success responses

XML format

<UpdateContainerGroup>
      <RequestId>CB8D2B22-D636-4182-****-1FC9DBDAD66F</RequestId>
</UpdateContainerGroup>

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 The error message returned because the specified CPU or memory specifications are invalid.
400 InvalidParameter.DuplicatedName The container group include containers with duplicate names. The error message returned because the elastic container instance contains containers with duplicate names.
400 InvalidParameter.DuplicatedVolumeName The container group includes volumes with duplicate names. The error message returned because the elastic container instance contains volumes with duplicate names.
400 InvalidParameter.LengthExceeded %s The error message returned because the length of the parameter that specifies a list exceeds the upper limit.
404 InvalidParameter.NotFound %s The error message returned because a specified parameter does not exist.
400 InvalidParameter.ValueExceeded %s The error message returned because a specified parameter is invalid.
400 IncorrectStatus %s The error message returned because the status of the specified elastic container instance is invalid.
403 InvalidAction The specified action is invalid The error message returned because the operation is invalid.
400 InvalidParam.CpuOrMemorySpec The specified specification is invalid. The error message returned because the specified specifications are unavailable. You cannot query the prices.
400 InvalidParameter %s The error message returned because a specified parameter is invalid.
400 MissingParameter %s The error message returned because a required parameter is not specified.
400 NoNeedUpdate There are no changes to be updated for current resource. The error message returned because this operation updates no parameters.

For a list of error codes, visit the API Error Center.