# Update a container


[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 /containers/{id}/update`

Change various configuration options of a container without having to
recreate it.


## 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/json' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "BlkioWeight": 300,
  "CpuPeriod": 100000,
  "CpuQuota": 50000,
  "CpuRealtimePeriod": 1000000,
  "CpuRealtimeRuntime": 10000,
  "CpuShares": 512,
  "CpusetCpus": "0,1",
  "CpusetMems": "0",
  "Memory": 314572800,
  "MemoryReservation": 209715200,
  "MemorySwap": 514288000,
  "RestartPolicy": {
    "MaximumRetryCount": 4,
    "Name": "on-failure"
  }
}' \
  'http://localhost/v1.57/containers/<ID>/update'
```



## Parameters

### id

Location: path. Required: yes.

ID or name of the container

```json
{
  "description": "ID or name of the container",
  "in": "path",
  "name": "id",
  "pointer": "/paths/~1containers~1{id}~1update/post/parameters/0",
  "required": true,
  "schema": {
    "type": "string"
  }
}
```

## Request and responses

### Request  application/json




Schema:

```json
{
  "allOf": [
    {
      "$ref": "#/components/schemas/Resources"
    },
    {
      "properties": {
        "RestartPolicy": {
          "$ref": "#/components/schemas/RestartPolicy"
        }
      },
      "type": "object"
    }
  ],
  "example": {
    "BlkioWeight": 300,
    "CpuPeriod": 100000,
    "CpuQuota": 50000,
    "CpuRealtimePeriod": 1000000,
    "CpuRealtimeRuntime": 10000,
    "CpuShares": 512,
    "CpusetCpus": "0,1",
    "CpusetMems": "0",
    "Memory": 314572800,
    "MemoryReservation": 209715200,
    "MemorySwap": 514288000,
    "RestartPolicy": {
      "MaximumRetryCount": 4,
      "Name": "on-failure"
    }
  }
}
```









Schema example:
```json
{
  "BlkioWeight": 300,
  "CpuPeriod": 100000,
  "CpuQuota": 50000,
  "CpuRealtimePeriod": 1000000,
  "CpuRealtimeRuntime": 10000,
  "CpuShares": 512,
  "CpusetCpus": "0,1",
  "CpusetMems": "0",
  "Memory": 314572800,
  "MemoryReservation": 209715200,
  "MemorySwap": 514288000,
  "RestartPolicy": {
    "MaximumRetryCount": 4,
    "Name": "on-failure"
  }
}
```


### Response 200 application/json

The container has been updated.


Schema:

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










### Response 404 application/json

no such container


Schema:

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









Example:
```json
{
  "message": "No such container: c2ada9df5af8"
}
```


### Response 500 application/json

server error


Schema:

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









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


## Complete operation contract

```json
{
  "description": "Change various configuration options of a container without having to\nrecreate it.\n",
  "operationId": "ContainerUpdate",
  "parameters": [
    {
      "description": "ID or name of the container",
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "allOf": [
            {
              "$ref": "#/components/schemas/Resources"
            },
            {
              "properties": {
                "RestartPolicy": {
                  "$ref": "#/components/schemas/RestartPolicy"
                }
              },
              "type": "object"
            }
          ],
          "example": {
            "BlkioWeight": 300,
            "CpuPeriod": 100000,
            "CpuQuota": 50000,
            "CpuRealtimePeriod": 1000000,
            "CpuRealtimeRuntime": 10000,
            "CpuShares": 512,
            "CpusetCpus": "0,1",
            "CpusetMems": "0",
            "Memory": 314572800,
            "MemoryReservation": 209715200,
            "MemorySwap": 514288000,
            "RestartPolicy": {
              "MaximumRetryCount": 4,
              "Name": "on-failure"
            }
          }
        }
      }
    },
    "required": true,
    "x-codegen-request-body-name": "update"
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ContainerUpdateResponse"
          }
        }
      },
      "description": "The container has been updated."
    },
    "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": "Update a container",
  "tags": [
    "Container"
  ]
}
```

## Referenced schemas

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

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

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

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




