Runs commands in a container.


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
RegionId String Yes cm-hangzhou

The region ID of the container group.

ContainerGroupId String Yes eci-xxx

The ID of the container group.

ContainerName String Yes nginx

The name of the container.

Command String Yes ["/bin/bash"]

The commands to be run in the container. You can specify up to 20 commands. Each command is a string and can be up to 256 characters in length. You must specify the commands in JSON format, for example, ["/bin/bash"] and ["ps","-ef"].

Action String No ExecContainerCommand

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

TTY Boolean No false

Specifies whether to enable interaction. Default value: false. For example, if the command is ["/bin/bash"], set this parameter to true.

Response parameters

Parameter Type Example Description
RequestId String 28B583A8-313D-4383-8EA9-B5A9F7E07817

The unique ID of the request.

WebSocketUri String wss:// s=xxx

The URL used to establish the WebSocket connection.


Sample requests

http(s):// Action=ExecContainerCommand
&Command= ["/bin/bash"]
&<Common request parameters>

Sample success responses

XML format

      <WebSocketUri>wss:// s=xxx</WebSocketUri>

JSON format

	"WebSocketUri":"wss:// s=xxx"

Error codes

HTTP status code Error code Error message Description
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.