All Products
Search
Document Center

ExecContainerCommand

Last Updated: Aug 15, 2019

You can call this operation to run commands inside the specified container.

Request parameters

Parameter Type Required Description
Action String Yes The operation that you want to perform. Set the value to ExecContainerCommand.
RegionId String Yes The region ID of the container group.
ContainerGroupId String Yes The ID of the container group.
ContainerName String Yes The name of the container.
Command String Yes An array of the command lines that you want to run. You can add a maximum of 20 command lines. A command line has a maximum of 256 characters in length. The strings must be in the JSON format, such as [, “/bin/bash”, and ].[“ps”,”-ef”]
TTY Boolean No Specifies whether the command lines are run in interactive mode. Default value: False. Set the TTY parameter to True if the command line is [, “/bin/bash”, or ].

Response parameters

Parameter Type Description
WebSocketUri String The WebSocket URI of the request.

Examples

Sample request

  1. http://eci.aliyuncs.com/?&Action=ExecContainerCommand
  2. &RegionId=cn-shanghai
  3. &ContainerGroupId=eci-xxx
  4. &ContainerName=nginx
  5. &Command=["/bin/sh"]
  6. &TTY=true
  7. &<Common request parameter>

Sample responses

JSON format
  1. {
  2. "WebSocketUri":""wss://eci-cn-shanghai.aliyun.com/exec/? s=xxx",
  3. "RequestId":"28B583A8-313D-4383-8EA9-B5A9F7E07817"
  4. }

Error codes

The operation also returns common errors. For more information about errors common to all operations, see Common 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 this operation is not available in the current status.