Container

Update a container

Changed on

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

post/containers/{id}/update

Request

  • Base URL
    /v1.57 (relative, and the document was published on a file host, not at the API’s origin)
  • Auth
    none declared

Path parameters

idstring required

ID or name of the container

Request body

CpuSharesinteger

An integer value representing this container's relative CPU weight versus other containers.

Memoryinteger

Memory limit in bytes.

CgroupParentstring

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.

BlkioWeightinteger

Block IO weight (relative weight).

CpuPeriodinteger

The length of a CPU period in microseconds.

CpuQuotainteger

Microseconds of CPU time that the container can get in a CPU period.

CpuRealtimePeriodinteger

The length of a CPU real-time period in microseconds. Set to 0 to allocate no time allocated to real-time tasks.

CpuRealtimeRuntimeinteger

The length of a CPU real-time runtime in microseconds. Set to 0 to allocate no time allocated to real-time tasks.

CpusetCpusstring

CPUs in which to allow execution (e.g., 0-3, 0,1).

CpusetMemsstring

Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.

DeviceCgroupRulesstring[]

a list of cgroup rules to apply to the container

MemoryReservationinteger

Memory soft limit in bytes.

MemorySwapinteger

Total memory limit (memory + swap). Set as -1 to enable unlimited swap.

MemorySwappinessinteger

Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100.

NanoCpusinteger

CPU quota in units of 10<sup>-9</sup> CPUs.

OomKillDisableboolean

Disable OOM Killer for the container.

Initboolean nullable

Run an init inside the container that forwards signals and reaps processes. This field is omitted if empty, and the default (as configured on the daemon) is used.

PidsLimitinteger nullable

Tune a container's PIDs limit. Set 0 or -1 for unlimited, or null to not change.

CpuCountinteger

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.

CpuPercentinteger

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.

IOMaximumIOpsinteger

Maximum IOps for the container system drive (Windows only)

IOMaximumBandwidthinteger

Maximum IO in bytes per second for the container system drive (Windows only).

Example request

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

Response

The container has been updated.

Warningsstring[]

Warnings encountered when updating the container.

Example response

{
  "Warnings": [
    "Published ports are discarded when using host network mode"
  ]
}

Changes

    • breaking

      removed the request body

    • breaking

      removed the media type application/json for the response with the status

    • info

      api tag Container added

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • breaking

      the request's body type changed from no type to object

    • warning

      removed subschema #2 from the request body allOf list

    • info

      api tag Container removed

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      removed the non-success response with the status

    • info

      removed the non-success response with the status