Search or ask Docker

Start an exec instance

POST /exec/{id}/start — Docker Engine API 1.57.

View Markdown
POST/exec/{id}/start
Starts a previously set up exec instance. If detach is true, this endpoint returns immediately after starting the command. Otherwise, it sets up an interactive session with the command.

Connection and access

API connection and authentication guidance

/v1.57

No HTTP authentication requirement is declared for this operation. Transport access controls can still apply.

Parameters

id path Required

Exec instance ID

Type: string

All schema constraints and annotations
{
  "type": "string"
}

Request and responses

Request

application/json

Type: object

ConsoleSize

Type: array

Initial console size, as an [height, width] array.
Array item

Type: integer

All schema constraints and annotations
{
  "minimum": 0,
  "type": "integer"
}
All schema constraints and annotations
{
  "description": "Initial console size, as an `[height, width]` array.",
  "example": [
    80,
    64
  ],
  "items": {
    "minimum": 0,
    "type": "integer"
  },
  "maxItems": 2,
  "minItems": 2,
  "type": "array",
  "x-nullable": true
}
Detach

Type: boolean

Detach from the command.
All schema constraints and annotations
{
  "description": "Detach from the command.",
  "example": false,
  "type": "boolean"
}
Tty

Type: boolean

Allocate a pseudo-TTY.
All schema constraints and annotations
{
  "description": "Allocate a pseudo-TTY.",
  "example": true,
  "type": "boolean"
}
All schema constraints and annotations
{
  "properties": {
    "ConsoleSize": {
      "description": "Initial console size, as an `[height, width]` array.",
      "example": [
        80,
        64
      ],
      "items": {
        "minimum": 0,
        "type": "integer"
      },
      "maxItems": 2,
      "minItems": 2,
      "type": "array",
      "x-nullable": true
    },
    "Detach": {
      "description": "Detach from the command.",
      "example": false,
      "type": "boolean"
    },
    "Tty": {
      "description": "Allocate a pseudo-TTY.",
      "example": true,
      "type": "boolean"
    }
  },
  "title": "ExecStartConfig",
  "type": "object"
}

Response 200

No error

application/vnd.docker.multiplexed-stream

Response 200

No error

application/vnd.docker.raw-stream

Response 404

No such exec instance

application/json

Schema: ErrorResponse

Schema example

{
  "message": "Something went wrong."
}

Response 409

Container is stopped or paused

application/json

Schema: ErrorResponse

Schema example

{
  "message": "Something went wrong."
}

Referenced schemas

#/components/schemas/ErrorResponse

Complete operation contract
{
  "description": "Starts a previously set up exec instance. If detach is true, this endpoint\nreturns immediately after starting the command. Otherwise, it sets up an\ninteractive session with the command.\n",
  "operationId": "ExecStart",
  "parameters": [
    {
      "description": "Exec instance ID",
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "properties": {
            "ConsoleSize": {
              "description": "Initial console size, as an `[height, width]` array.",
              "example": [
                80,
                64
              ],
              "items": {
                "minimum": 0,
                "type": "integer"
              },
              "maxItems": 2,
              "minItems": 2,
              "type": "array",
              "x-nullable": true
            },
            "Detach": {
              "description": "Detach from the command.",
              "example": false,
              "type": "boolean"
            },
            "Tty": {
              "description": "Allocate a pseudo-TTY.",
              "example": true,
              "type": "boolean"
            }
          },
          "title": "ExecStartConfig",
          "type": "object"
        }
      }
    },
    "x-codegen-request-body-name": "execStartConfig"
  },
  "responses": {
    "200": {
      "content": {
        "application/vnd.docker.multiplexed-stream": {},
        "application/vnd.docker.raw-stream": {}
      },
      "description": "No error"
    },
    "404": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "No such exec instance"
    },
    "409": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "Container is stopped or paused"
    }
  },
  "summary": "Start an exec instance",
  "tags": [
    "Exec"
  ]
}