You can call this operation to run 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
Action String No ExecContainerCommand

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

RegionId String Yes cn-hangzhou

The region ID of the elastic container instance.

ContainerGroupId String Yes eci-2zebxkiifulhl****

The ID of the elastic container instance.

ContainerName String Yes nginx

The name of the container.

Command String Yes ls

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

The strings must be in the JSON format. Example: ["ls", "-a"].

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.

Stdin Boolean No true

Specifies whether to read the commands from standard input (stdin). Default value: true.

Response parameters

Parameter Type Example Description
HttpUrl String****

The HTTP URL. You can use this URL to enter the container within 30 seconds after this operation is called. For more information, see Use and integrate the Elastic Container Instance terminal.

RequestId String 28B583A8-313D-4383-7817-B5A9F7E0****

The ID of the request.

WebSocketUri String wss://****

The WebSocket URL. You can use this URL to establish a WebSocket connection to the container.


Sample requests
&<Common request parameters>

Sample success responses

XML format


JSON format

    "RequestId": "28B583A8-313D-4383-7817-B5A9F7E0****",
    "WebSocketUri": "wss://****",
    "HttpUrl": "****"

Error codes

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

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