# Start an exec instance


[API catalog](/reference/api/) · [Docker Engine overview](/reference/api/engine/version/v1.57/) · [Product manual](https://docs.docker.com/engine/) · [OpenAPI specification](/reference/api/engine/version/v1.57.yaml)

API version: 1.57





`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](/reference/api/engine/version/v1.57/#connection)


Server: `/v1.57`

Effective security: alternatives are OR; schemes within an alternative are AND. An empty array declares no HTTP authentication requirement.

```json
null
```

## Example request

Replace placeholders and provide the required credentials or request body.

```console
curl \
  --request POST \
  --unix-socket "${DOCKER_SOCKET:-/var/run/docker.sock}" \
  --header 'Accept: application/vnd.docker.multiplexed-stream' \
  --header 'Content-Type: application/json' \
  --data-binary @request-body \
  'http://localhost/v1.57/exec/<ID>/start'
```


Prepare request-body using the selected media type and schema.


## Parameters

### id

Location: path. Required: yes.

Exec instance ID

```json
{
  "description": "Exec instance ID",
  "in": "path",
  "name": "id",
  "pointer": "/paths/~1exec~1{id}~1start/post/parameters/0",
  "required": true,
  "schema": {
    "type": "string"
  }
}
```

## Request and responses

### Request  application/json




Schema:

```json
{
  "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 application/vnd.docker.multiplexed-stream

No error











### Response 200 application/vnd.docker.raw-stream

No error











### Response 404 application/json

No such exec instance


Schema:

```json
{
  "$ref": "#/components/schemas/ErrorResponse"
}
```









Schema example:
```json
{
  "message": "Something went wrong."
}
```


### Response 409 application/json

Container is stopped or paused


Schema:

```json
{
  "$ref": "#/components/schemas/ErrorResponse"
}
```









Schema example:
```json
{
  "message": "Something went wrong."
}
```


## Complete operation contract

```json
{
  "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"
  ]
}
```

## Referenced schemas

- [#/components/schemas/ErrorResponse](/reference/api/engine/version/v1.57/schemas/ErrorResponse/)




