Updates an elastic container instance.

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.
  • The configurations of elastic container instances cannot be changed. However, you can change the configurations of the individual containers within the instance as long as the change does not affect instance specifications.
  • You cannot update 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 Yes 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 that you want to update.

RegionId String Yes cn-hangzhou

The ID of the region.

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, and you must make sure that it is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence.

ResourceGroupId String No rg-2df3isufhi38****

The ID of the resource group.

Container.N.ReadinessProbe.TimeoutSeconds Integer No 5

The timeout period of the readiness probe. Unit: seconds. Default value: 1. 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.SecurityContext.Capability.Add.N RepeatList No NET_ADMIN

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

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

The port used for TCP socket probes.

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.LivenessProbe.PeriodSeconds Integer No 10

The interval for the liveness probe. Unit: seconds. Default value: 10. 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.EnvironmentVar.N.Key String No PATH

The name of the environment variable for container N.

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

The value of the environment variable for container N.

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

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

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

The port used for TCP socket probes.

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.WorkingDir String No /usr/share/

The working directory of container N.

Container.N.Arg.N RepeatList No hello

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

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 EoF error may occur. Default value: false.

Container.N.LivenessProbe.InitialDelaySeconds Integer No 10

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

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.
  • HostToContainer: The volume mount receives all subsequent mounts that are mounted to this volume or its subdirectories.
  • Bidirectional: This value is similar to HostToContainer. 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 host and to all containers of all pods that use the same volume.

Default value: None.

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

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

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

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

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

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

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

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

Container.N.ImagePullPolicy String No Never

The image pulling policy of container N.

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, streams are also disconnected and remain in the disconnected state until the container is started again.

Container.N.ReadinessProbe.PeriodSeconds Integer No 10

The interval for the readiness probe. 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.Command.N RepeatList No echo

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

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

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

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

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

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

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

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

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

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.ReadinessProbe.HttpGet.Port Integer No 8080

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

Container.N.Gpu Integer No 1

The number of GPUs allocated to container N.

Container.N.ReadinessProbe.InitialDelaySeconds Integer No 10

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

Container.N.Memory Float No 2.0

The amount of memory allocated to container N.

Container.N.Name String No jenkins

The name of container N.

Container.N.Image String No jenkins

The image of container N.

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.ReadinessProbe.Exec.Command.N RepeatList No [/bin/sh cat /tmp/healthy]

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

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.Cpu Float No 1.0

The number of vCPUs allocated to container N.

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.Path String No /usr/local/bin

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

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.RunAsUser Long No 1337

The UID used to run the entry point 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.Image String No nginx

The image of init container N.

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.
  • HostToContainer: The volume mount receives all subsequent mounts that are mounted to this volume or its subdirectories.
  • Bidirectional: This value is similar to HostToContainer. 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 host and to all containers of all pods that use the same volume.

Default value: None.

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

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

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

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

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

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

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

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

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

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

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

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

InitContainer.N.SecurityContext.ReadOnlyRootFilesystem Boolean No true

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

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

The name of the environment variable for init container N.

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

The value of the environment variable for init container N.

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

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

InitContainer.N.ImagePullPolicy String No Onfailure

The image pulling policy of init container N.

InitContainer.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 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.Cpu Float No 2.0

The number of vCPUs allocated to init container N.

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.WorkingDir String No /bin/local/

The working directory of init container N.

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

The commands of init container N.

InitContainer.N.Arg.N RepeatList No 10

The startup arguments of init container N.

InitContainer.N.SecurityContext.RunAsUser Long No 1000

The UID used to run the entry point of the container process.

InitContainer.N.Gpu Integer No 1

The number of GPUs allocated to init container N.

InitContainer.N.Memory Float No 4.0

The amount of memory allocated to init container N.

InitContainer.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 EoF error may occur. Default value: false.

InitContainer.N.Name String No init-nginx

The name of init container N.

ImageRegistryCredential.N.Password String No yourpassword

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

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

The URL of image repository N, without the http:// or https:// prefix.

ImageRegistryCredential.N.UserName String No yourname

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

Parameters

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.
ImageRegistryCredential parameters
  • ImageRegistryCredential parameters support only full updates.
  • If only ImageRegistryCredential parameters are updated, and the updated number of ImageRegistryCredential parameters is not greater than the previous 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 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 CPU and memory specifications are invalid.
400 InvalidParameter.DuplicatedName The container group include containers with duplicate names. The error message returned because the container group contains containers with duplicate names.
400 InvalidParameter.DuplicatedVolumeName The container group includes volumes with duplicate names. The error message returned because the container group 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.
400 InvalidParameter.ValueExceeded %s The error message returned because the parameter value is out of the valid range.
400 IncorrectStatus %s The error message returned because the status of the specified elastic container instance is invalid.
400 InvalidParam.CpuOrMemorySpec The specified specification is invalid. The error message returned because the specified instance type is unavailable. You cannot query the price of the instance type.
400 InvalidParameter %s The error message returned because the 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.
403 InvalidAction The specified action is invalid The error message returned because the operation is invalid.
404 InvalidParameter.NotFound %s The error message returned because the specified parameter does not exist.

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