Search or ask Docker

Restart a container

POST /containers/{id}/restart — Docker Engine API 1.57.

View Markdown
POST/containers/{id}/restart

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"
}

signal query

Signal to send to the container as an integer or string (e.g. SIGINT).

Type: string

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

t query

Number of seconds to wait before killing the container

Type: integer

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

Request and responses

Response 204

no error

No response content is declared.

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": "ContainerRestart",
  "parameters": [
    {
      "description": "ID or name of the container",
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "description": "Signal to send to the container as an integer or string (e.g. `SIGINT`).\n",
      "in": "query",
      "name": "signal",
      "schema": {
        "type": "string"
      }
    },
    {
      "description": "Number of seconds to wait before killing the container",
      "in": "query",
      "name": "t",
      "schema": {
        "type": "integer"
      }
    }
  ],
  "responses": {
    "204": {
      "description": "no error"
    },
    "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": "Restart a container",
  "tags": [
    "Container"
  ]
}