You can call this operation to update a container group.
Description
1. You can only update container groups that are in the Pending or Running state.
2. You cannot update container groups that were created before 15:00:00, March 7, 2019.
3. You cannot change the specification of a container group. You can only change the specifications of containers inside the container group.
4. When a container group is being updated, it is in the Updating state.
Debugging
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-bp17da5olmkuagfrzurh |
The ID of the container group that you want to update. |
RegionId | String | Yes | cn-hangzhou |
The ID of the region where the container group is deployed. |
RestartPolicy | String | No | Always |
The restart policy of the container group. |
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, and ConfigFileVolume. |
Volume.N.NFSVolume.Server | String | No | 0eaf24bfc1-xxxxx.cn-hangzhou.nas.aliyuncs.com |
The address of the NFS server. |
Volume.N.NFSVolume.Path | String | No | / |
The path to the NFS volume. |
Volume.N.NFSVolume.ReadOnly | Boolean | No | false |
Default value: false. |
Volume.N.ConfigFileVolume.ConfigFileToPath.N.Content | String | No | bGl1bWk= |
The content of the configuration file. Maximum size: 32 KB. |
Volume.N.ConfigFileVolume.ConfigFileToPath.N.Path | String | No | liu/name |
The relative file path. |
Volume.N.EmptyDirVolume.Medium | String | No | Memory |
The storage medium of EmptyDirVolume. By default, no value is specified, which indicates that EmptyDirVolume uses the node file system as storage. You can also set the value to Memory to use the memory as storage. |
DnsConfig.NameServer.N | RepeatList | No | 1.2.3.4 |
The list of DNS server IP addresses. |
DnsConfig.Search.N | RepeatList | No | my.dns.search.suffix |
The list of DNS lookup domains. |
DnsConfig.Option.N.Name | String | No | ndots |
The name of the variable. |
DnsConfig.Option.N.Value | String | No | 2 |
The value of the variable. |
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 amount of CPU resources allocated to the container group. |
Container.N.Memory | Float | No | 2.0 |
The amount of memory resources allocated to the container group. |
Container.N.WorkingDir | String | No | /usr/share/ |
The working directory for the container. |
Container.N.ImagePullPolicy | String | No | Never |
The policy for pulling an image. |
Container.N.Stdin | Boolean | No | false |
Specifies whether the container allocates buffer resources to standard input streams while the container is running. If no value is specified, an end of file (EoF) error may occur. Default value: false. |
Container.N.StdinOnce | Boolean | No | true |
If Stdin is set to true, standard input steams 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 is started again. |
Container.N.Tty | Boolean | No | false |
Specifies whether to enable interaction. Default is false. For example, if the command is "/bin/bash", set the value to true. |
Container.N.Command.N | RepeatList | No | echo |
The commands run by the container. You can define a maximum of 20 commands. Minimum length per string: 256 characters |
Container.N.Arg.N | RepeatList | No | hello |
The arguments passed to the commands. Maximum: 10. |
Container.N.EnvironmentVar.N.Key | String | No | PATH |
The name of the environment variable of the container. |
Container.N.EnvironmentVar.N.Value | String | No | /usr/bin/local/ |
The value of the environment variables of the container. |
Container.N.Port.N.Protocol | String | No | TCP |
TCP or UDP |
Container.N.Port.N.Port | Integer | No | 8080 |
The port number. Valid values: 1 to 65535. |
Container.N.VolumeMount.N.Name | String | No | test-empty |
The name of the volume. The name is the same as the volume you selected when you purchased the container. |
Container.N.VolumeMount.N.MountPath | String | No | /usr/share/ |
The directory of the mounted volume. Data under this directory will be overwritten by the data in the volume. |
Container.N.VolumeMount.N.SubPath | String | No | /usr/share/sub/ |
The subdirectory of the mounted volume. The container group can mount different directories of the same volume to different subdirectories of containers. |
Container.N.VolumeMount.N.ReadOnly | Boolean | No | false |
Default value: false. |
Container.N.ReadinessProbe.TcpSocket.Port | Integer | No | 5000 |
The port used to test TCP sockets. |
Container.N.ReadinessProbe.Exec.Command.N | RepeatList | No | [/bin/sh cat /tmp/healthy] |
The command to run detection tasks in the container. |
Container.N.ReadinessProbe.HttpGet.Path | String | No | /usr/ |
The path to the HTTP GET method. |
Container.N.ReadinessProbe.HttpGet.Port | Integer | No | 8080 |
The port for the HTTP GET method. |
Container.N.ReadinessProbe.HttpGet.Scheme | String | No | HTTP |
Valid values: HTTP and HTTPS. |
Container.N.ReadinessProbe.InitialDelaySeconds | Integer | No | 10 |
The time when the detection starts. The initial time is when the container is started. |
Container.N.ReadinessProbe.PeriodSeconds | Integer | No | 10 |
The detection interval in seconds. The default is 10, and minimum is 1. |
Container.N.ReadinessProbe.SuccessThreshold | Integer | No | 3 |
After the last detection failed, the minimum number of times that a detection must be successful consecutively before the detection is declared successful. Default is 1. |
Container.N.ReadinessProbe.FailureThreshold | Integer | No | 3 |
After the last detection succeeded, the minimum number of times that a detection must fail consecutively before the detection is declared failed. Default is 3. |
Container.N.ReadinessProbe.TimeoutSeconds | Integer | No | 5 |
The detection timeout period in seconds. Default is 1, and minimum is 1 |
Container.N.LivenessProbe.TcpSocket.Port | Integer | No | 80 |
The port used to test TCP sockets. |
Container.N.LivenessProbe.Exec.Command.N | RepeatList | No | [/bin/sh cat /tmp/healthy] |
The command to run detection tasks in the container. |
Container.N.LivenessProbe.HttpGet.Path | String | No | /usr/local/bin |
The path to the HTTP GET method. |
Container.N.LivenessProbe.HttpGet.Port | Integer | No | 8080 |
The port for the HTTP GET method. |
Container.N.LivenessProbe.HttpGet.Scheme | String | No | HTTP |
Valid values include HTTP and HTTPS. |
Container.N.LivenessProbe.InitialDelaySeconds | Integer | No | 10 |
The time when the detection starts. The initial time is when the container is started. |
Container.N.LivenessProbe.PeriodSeconds | Integer | No | 10 |
The detection interval in seconds. Default is 10, and minimum is 1. |
Container.N.LivenessProbe.SuccessThreshold | Integer | No | 1 |
After the last detection failed, the minimum number of times that a detection must be successful consecutively before the detection is declared successful. Default is 1. Currently, the value must be 1. |
Container.N.LivenessProbe.FailureThreshold | Integer | No | 3 |
After the last detection succeeded, the minimum number of times that a detection must fail consecutively before the detection is declared failed. Default is 3. |
Container.N.LivenessProbe.TimeoutSeconds | Integer | No | 1 |
The detection timeout period in seconds. Default is 1, and minimum is 1. |
Container.N.SecurityContext.ReadOnlyRootFilesystem | Boolean | No | true |
Currently, the only valid value is true. |
Container.N.SecurityContext.RunAsUser | Long | No | 1337 |
The UID of the endpoint where you can run container processes. |
Container.N.SecurityContext.Capability.Add.N | RepeatList | No | NET_ADMIN |
Currently, the only valid value is NET_ADMIN. |
Container.N.Gpu | Integer | No | 1 |
The amount of GPU resources 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 container. |
InitContainer.N.Cpu | Float | No | 2.0 |
The amount of CPU resources allocated to the container group. |
InitContainer.N.Memory | Float | No | 4.0 |
The amount of memory resources allocated to the container group. |
InitContainer.N.WorkingDir | String | No | /bin/local/ |
The working directory for the container. |
InitContainer.N.ImagePullPolicy | String | No | Onfailure |
The policy for pulling an image. |
InitContainer.N.Stdin | Boolean | No | false |
Specifies whether the container allocates buffer resources to standard input streams while the container is running. If no value is specified, an end of file (EoF) error may occur. Default value: false. |
InitContainer.N.StdinOnce | Boolean | No | true |
If Stdin is set to true, standard input steams 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 is started again. |
InitContainer.N.Tty | Boolean | No | true |
Specifies whether interaction is enabled. Default is false. For example, if the command is "/bin/bash", set the value to true. |
InitContainer.N.Command.N | RepeatList | No | /bin/sh sleep |
The commands run by the init container. |
InitContainer.N.Arg.N | RepeatList | No | 10 |
The arguments passed to the commands. |
InitContainer.N.EnvironmentVar.N.Key | String | No | PATH |
The name of the environment variable. |
InitContainer.N.EnvironmentVar.N.Value | String | No | /usr/local/bin |
The value of the environment variable. |
InitContainer.N.Port.N.Port | Integer | No | 9000 |
The port number. Valid values: 1 to 65535. |
InitContainer.N.Port.N.Protocol | String | No | TCP |
Valid values include TCP and UDP. |
InitContainer.N.VolumeMount.N.Name | String | No | default-volume1 |
The name of the volume. The name is the same as the volume you selected when you purchased the container. |
InitContainer.N.VolumeMount.N.MountPath | String | No | /pod/data |
The directory of the mounted volume. Data under this directory will be overwritten by the data in the volume. |
InitContainer.N.VolumeMount.N.SubPath | String | No | data2/ |
The subdirectory of the mounted volume. The container group can mount different directories of the same volume to different subdirectories of containers. |
InitContainer.N.VolumeMount.N.ReadOnly | Boolean | No | false |
Default value: false. |
InitContainer.N.SecurityContext.ReadOnlyRootFilesystem | Boolean | No | true |
Specifies whether the root file system is set to the read-only mode. |
InitContainer.N.SecurityContext.RunAsUser | Long | No | 1000 |
The UID of the endpoint where you can run container processes. |
InitContainer.N.SecurityContext.Capability.Add.N | RepeatList | No | NET_ADMIN |
Currently, the only valid value is NET_ADMIN. |
InitContainer.N.Gpu | Integer | No | 1 |
The amount of GPU resources allocated to the container. |
ImageRegistryCredential.N.Server | String | No | registry.cn-shanghai.aliyuncs.com/ecitest/nginx:alpine |
The image repository without the 1. Only supports full updates. 2. If only ImageRegistryCredentials (image registry credentials) are updated, and the number of ImageRegistryCredentials is no greater than the previous number, you do not need to restart the container group. Otherwise, you need to restart the container group. |
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, which is used to ensure the idempotency of requests. 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 amount of CPU resources allocated to the container group. |
Memory | Float | No | 4.0 |
The amount of memory resources allocated to the container group. |
Parameters and descriptions
Cpu (CPU resources allocated to the container group):
1. This parameter cannot be updated, but it takes effect.
2. By default, ECI calculates the specification of a container group based on the container specifications. If you want the specification of the container group to change with the specifications of the containers, you must specify the specification of the container group.
Memory (Memory resources allocated to the container group):
1. This parameter cannot be updated, but it takes effect.
2. Be default, ECI calculates the specification of a container group based on the container specifications. If you want the specification of the container group to change with the specifications of the containers, you must specify the specification of the container group.
Volumes1. Only supports full updates.
2. You need to restart the container group.
ImageRegistryCredentials1. Only supports full updates.
2. If only ImageRegistryCredentials (image registry credentials) are updated, and the number of ImageRegistryCredentials is no more than the previous number, you do not need to restart the container group. Otherwise, you must restart the container group.
InitContainers1. Only supports full updates.
2. Init containers and other containers only support full updates. However, you can choose to update either init containers or other containers. If the container group does not contain any init containers, you can add init containers to the container group.
3. You need to restart the container group.
Containers1. Only supports full updates.
Tags1. Only supports full updates.
2. You do not need to restart the container group.
DnsConfig1. Only supports full updates.
2. You need to restart the container group.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | CB8D2B22-D636-4182-8C8C-1FC9DBDAD66F |
The unique ID of the request. |
Examples
Sample requests
http(s)://eci.aliyuncs.com/? Action=UpdateContainerGroup
&ContainerGroupId=eci-bp17da5olmkuagfrzurh
&RegionId=cn-hangzhou
&<Common request parameters>
Sample success responses
JSON
format
{
"RequestId": "CB8D2B22-D636-4182-8C8C-1FC9DBDAD66F"
}
XML
format
<RequestId>CB8D2B22-D636-4182-8C8C-1FC9DBDAD66F</RequestId>
Common scenarios
ContainerAll parameters of a container can be updated. The parameters are the same as those used to create the container.
A container group contains both init containers and other containers, but only the init containers need to be updated.
A container group contains both init containers and other containers, but only the other containers need to be updated.
A container group contains both init containers and other containers, and all these containers need to be updated.
A container group contains containers, and these containers need to be updated.
A container group contains containers, and you need to add init containers.
A container group only contains containers, and you need to add init containers and updated the existing containers.
VolumeECI supports three types of volumes: ConfigFileVolume, NFSVolume, and EmptyDirVolume.
These types of volumes can be updated. Parameters of a volume after an update are the same as those used to create the volume.
Note: Volumes are mounted to specific containers by volume name. When you update volumes, you can only update 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.ImageRegistryCredentialImageRegistryCredentials can be updated separately or updated along with other parameters. If only ImageRegistryCredentials are updated,
and the number of vImageRegistryCredentials is no greater than the previous number,
you do not need to restart the container group. Otherwise, you need to restart the container group.
TagsAll tags are updated. You do not need to restart the container group.
DnsConfigOnly supports full updates.
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 duplicate container names. |
400 | InvalidParameter.DuplicatedVolumeName | The container group includes volumes with duplicate names. | The error message returned because the container group contains duplicate volume 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 the specified parameter cannot be found. |
400 | InvalidParameter.ValueExceeded | %s | The error message returned because the specified parameter value is invalid. |
400 | IncorrectStatus | %s | The error message returned because the status of the specified container group is invalid. |
403 | InvalidAction | The specified action is invalid | The error message returned because the specified action is invalid. |
400 | InvalidParam.CpuOrMemorySpec | The specified specification is invalid. | The error message returned because the specified specification is unavailable. You cannot query the prices. |
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 set. |
400 | NoNeedUpdate | There are no changes to be updated for current resource. | The error message returned because this operation does not require any parameter to be updated. |