---
title: "Update a container"
method: POST
path: "/containers/{id}/update"
tags: ["Container"]
---

# Update a container

`POST /containers/{id}/update`

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

## Path parameters

- `id` string, required

## Request body

- object — A container's resources (cgroups config, ulimits, etc)
  - `BlkioDeviceReadBps` ThrottleDevice[] — Limit read rate (bytes per second) from a device, in the form `[{"Path": "device_path", "Rate": rate}]`.
    - `Path` string — Device path
    - `Rate` integer — Rate
  - `BlkioDeviceReadIOps` ThrottleDevice[] — Limit read rate (IO per second) from a device, in the form `[{"Path": "device_path", "Rate": rate}]`.
    - `Path` string — Device path
    - `Rate` integer — Rate
  - `BlkioDeviceWriteBps` ThrottleDevice[] — Limit write rate (bytes per second) to a device, in the form `[{"Path": "device_path", "Rate": rate}]`.
    - `Path` string — Device path
    - `Rate` integer — Rate
  - `BlkioDeviceWriteIOps` ThrottleDevice[] — Limit write rate (IO per second) to a device, in the form `[{"Path": "device_path", "Rate": rate}]`.
    - `Path` string — Device path
    - `Rate` integer — Rate
  - `BlkioWeight` integer — Block IO weight (relative weight).
  - `BlkioWeightDevice` object[] — Block IO weight (relative device weight) in the form `[{"Path": "device_path", "Weight": weight}]`.
    - `Path` string
    - `Weight` integer
  - `CgroupParent` string — Path to `cgroups` under which the container's `cgroup` is created. If the path is not absolute, the path is considered to be relative to the `cgroups` path of the init process. Cgroups are created if they do not already exist.
  - `CpuCount` integer — The number of usable CPUs (Windows only). On Windows Server containers, the processor resource controls are mutually exclusive. The order of precedence is `CPUCount` first, then `CPUShares`, and `CPUPercent` last.
  - `CpuPercent` integer — The usable percentage of the available CPUs (Windows only). On Windows Server containers, the processor resource controls are mutually exclusive. The order of precedence is `CPUCount` first, then `CPUShares`, and `CPUPercent` last.
  - `CpuPeriod` integer — The length of a CPU period in microseconds.
  - `CpuQuota` integer — Microseconds of CPU time that the container can get in a CPU period.
  - `CpuRealtimePeriod` integer — The length of a CPU real-time period in microseconds. Set to 0 to allocate no time allocated to real-time tasks.
  - `CpuRealtimeRuntime` integer — The length of a CPU real-time runtime in microseconds. Set to 0 to allocate no time allocated to real-time tasks.
  - `CpuShares` integer — An integer value representing this container's relative CPU weight versus other containers.
  - `CpusetCpus` string — CPUs in which to allow execution (e.g., `0-3`, `0,1`)
  - `CpusetMems` string — Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.
  - `DeviceCgroupRules` string[] — a list of cgroup rules to apply to the container
  - `Devices` DeviceMapping[] — A list of devices to add to the container.
    - `CgroupPermissions` string
    - `PathInContainer` string
    - `PathOnHost` string
  - `DiskQuota` integer — Disk limit (in bytes).
  - `IOMaximumBandwidth` integer — Maximum IO in bytes per second for the container system drive (Windows only)
  - `IOMaximumIOps` integer — Maximum IOps for the container system drive (Windows only)
  - `KernelMemory` integer — Kernel memory limit in bytes.
  - `Memory` integer — Memory limit in bytes.
  - `MemoryReservation` integer — Memory soft limit in bytes.
  - `MemorySwap` integer — Total memory limit (memory + swap). Set as `-1` to enable unlimited swap.
  - `MemorySwappiness` integer — Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100.
  - `NanoCPUs` integer — CPU quota in units of 10<sup>-9</sup> CPUs.
  - `OomKillDisable` boolean — Disable OOM Killer for the container.
  - `PidsLimit` integer — Tune a container's pids limit. Set -1 for unlimited.
  - `Ulimits` object[] — A list of resource limits to set in the container. For example: `{"Name": "nofile", "Soft": 1024, "Hard": 2048}`"
    - `Hard` integer — Hard limit
    - `Name` string — Name of ulimit
    - `Soft` integer — Soft limit
  - `RestartPolicy` RestartPolicy — The behavior to apply when the container exits. The default is not to restart. An ever increasing delay (double the previous delay, starting at 100ms) is added before each restart to prevent flooding the server.
    - `MaximumRetryCount` integer — If `on-failure` is used, the number of times to retry before giving up
    - `Name` '' | 'always' | 'unless-stopped' | 'on-failure' — - Empty string means not to restart - `always` Always restart - `unless-stopped` Restart always except when the user has manually stopped the container - `on-failure` Restart only when the container exit code is non-zero

## Response `200`

The container has been updated.

- object
  - `Warnings` string[]

## Other responses

- `404` — no such container
- `500` — server error

---

[API](https://skmtc.net/docker/apis/engine.md) · [All operations](https://skmtc.net/docker/apis/engine/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/docker/engine/versions/400730735b03/schema)
