Runs commands in a container.

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
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://eci-cn-shanghai.aliyun.com/exec/? s=xxx

The URL used to establish the WebSocket connection.

Examples

Sample requests


http(s)://eci.aliyuncs.com/? Action=ExecContainerCommand
&RegionId=cm-hangzhou
&ContainerGroupId=eci-xxx
&ContainerName=nginx
&Command= ["/bin/bash"]
&<Common request parameters>

Sample success responses

XML format

<ExecContainerCommandResponse>
      <RequestId>45D5B0AD-3B00-4A9B-9911-6D5303B06712</RequestId>
      <WebSocketUri>wss://eci-cn-shanghai.aliyun.com/exec/? s=xxx</WebSocketUri>
</ExecContainerCommandResponse>

JSON format

{
	"RequestId":"45D5B0AD-3B00-4A9B-9911-6D5303B06712",
	"WebSocketUri":"wss://eci-cn-shanghai.aliyun.com/exec/? 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.