Search or ask Docker

Attach to a container via a websocket

GET /containers/{id}/attach/ws — Docker Engine API 1.57.

View Markdown
GET/containers/{id}/attach/ws

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

ID or name of the container

Type: string

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

detachKeys query

Override the key sequence for detaching a container.Format is a single character [a-Z] or ctrl-<value> where <value> is one of: a-z, @, ^, [, ,, or _.

Type: string

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

logs query

Return logs

Type: boolean

All schema constraints and annotations
{
  "default": false,
  "type": "boolean"
}

stream query

Return stream

Type: boolean

All schema constraints and annotations
{
  "default": false,
  "type": "boolean"
}

stdin query

Attach to stdin

Type: boolean

All schema constraints and annotations
{
  "default": false,
  "type": "boolean"
}

stdout query

Attach to stdout

Type: boolean

All schema constraints and annotations
{
  "default": false,
  "type": "boolean"
}

stderr query

Attach to stderr

Type: boolean

All schema constraints and annotations
{
  "default": false,
  "type": "boolean"
}

Request and responses

Response 101

no error, hints proxy about hijacking

application/json

Response 101

no error, hints proxy about hijacking

text/plain

Response 200

no error, no upgrade header found

application/json

Response 200

no error, no upgrade header found

text/plain

Response 400

bad parameter

application/json

Schema: ErrorResponse

Schema example

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

Response 404

no such container

application/json

Schema: ErrorResponse

Example

{
  "message": "No such container: c2ada9df5af8"
}

Response 500

server error

application/json

Schema: ErrorResponse

Schema example

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

Referenced schemas

#/components/schemas/ErrorResponse

Complete operation contract
{
  "operationId": "ContainerAttachWebsocket",
  "parameters": [
    {
      "description": "ID or name of the container",
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "description": "Override the key sequence for detaching a container.Format is a single\ncharacter `[a-Z]` or `ctrl-\u003cvalue\u003e` where `\u003cvalue\u003e` is one of: `a-z`,\n`@`, `^`, `[`, `,`, or `_`.\n",
      "in": "query",
      "name": "detachKeys",
      "schema": {
        "type": "string"
      }
    },
    {
      "description": "Return logs",
      "in": "query",
      "name": "logs",
      "schema": {
        "default": false,
        "type": "boolean"
      }
    },
    {
      "description": "Return stream",
      "in": "query",
      "name": "stream",
      "schema": {
        "default": false,
        "type": "boolean"
      }
    },
    {
      "description": "Attach to `stdin`",
      "in": "query",
      "name": "stdin",
      "schema": {
        "default": false,
        "type": "boolean"
      }
    },
    {
      "description": "Attach to `stdout`",
      "in": "query",
      "name": "stdout",
      "schema": {
        "default": false,
        "type": "boolean"
      }
    },
    {
      "description": "Attach to `stderr`",
      "in": "query",
      "name": "stderr",
      "schema": {
        "default": false,
        "type": "boolean"
      }
    }
  ],
  "responses": {
    "101": {
      "content": {
        "application/json": {},
        "text/plain": {}
      },
      "description": "no error, hints proxy about hijacking"
    },
    "200": {
      "content": {
        "application/json": {},
        "text/plain": {}
      },
      "description": "no error, no upgrade header found"
    },
    "400": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "bad parameter"
    },
    "404": {
      "content": {
        "application/json": {
          "example": {
            "message": "No such container: c2ada9df5af8"
          },
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "no such container"
    },
    "500": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "server error"
    }
  },
  "summary": "Attach to a container via a websocket",
  "tags": [
    "Container"
  ]
}