Update a container Run in API Explorer
Change various configuration options of a container without having to recreate it.
Body
Required
-
Memory limit in bytes.
Default value is
0
. -
Path to
cgroups
under which the container'scgroup
is created. If the path is not absolute, the path is considered to be relative to thecgroups
path of the init process. Cgroups are created if they do not already exist. -
Block IO weight (relative weight).
Minimum value is
0
, maximum value is1000
. -
Block IO weight (relative device weight) in the form:
[{"Path": "device_path", "Weight": weight}]
-
Limit read rate (bytes per second) from a device, in the form:
[{"Path": "device_path", "Rate": rate}]
-
Limit write rate (bytes per second) to a device, in the form:
[{"Path": "device_path", "Rate": rate}]
-
Limit read rate (IO per second) from a device, in the form:
[{"Path": "device_path", "Rate": rate}]
-
Limit write rate (IO per second) to a device, in the form:
[{"Path": "device_path", "Rate": rate}]
-
The length of a CPU period in microseconds.
-
Microseconds of CPU time that the container can get in a CPU period.
-
The length of a CPU real-time period in microseconds. Set to 0 to allocate no time allocated to real-time tasks.
-
The length of a CPU real-time runtime in microseconds. Set to 0 to allocate no time allocated to real-time tasks.
-
CPUs in which to allow execution (e.g.,
0-3
,0,1
). -
Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.
-
A list of devices to add to the container.
A device mapping between the host and container
-
a list of cgroup rules to apply to the container
-
A list of requests for devices to be sent to device drivers.
A request for devices to be sent to device drivers
-
Hard limit for kernel TCP buffer memory (in bytes). Depending on the OCI runtime in use, this option may be ignored. It is no longer supported by the default (runc) runtime.
This field is omitted when empty.
-
Memory soft limit in bytes.
-
Total memory limit (memory + swap). Set as
-1
to enable unlimited swap. -
Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100.
Minimum value is
0
, maximum value is100
. -
CPU quota in units of 10-9 CPUs.
-
Disable OOM Killer for the container.
-
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.
-
Tune a container's PIDs limit. Set
0
or-1
for unlimited, ornull
to not change. -
A list of resource limits to set in the container. For example:
{"Name": "nofile", "Soft": 1024, "Hard": 2048}
-
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, thenCPUShares
, andCPUPercent
last. -
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, thenCPUShares
, andCPUPercent
last. -
Maximum IOps for the container system drive (Windows only)
-
Maximum IO in bytes per second for the container system drive (Windows only).
-
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.
curl \
--request POST 'http://api.example.com/v1.49/containers/{id}/update' \
--header "Content-Type: application/json" \
--data '{"Memory":314572800,"CpuQuota":50000,"CpuPeriod":100000,"CpuShares":512,"CpusetCpus":"0,1","CpusetMems":"0","MemorySwap":514288000,"BlkioWeight":300,"RestartPolicy":{"Name":"on-failure","MaximumRetryCount":4},"CpuRealtimePeriod":1000000,"MemoryReservation":209715200,"CpuRealtimeRuntime":10000}'
{
"Memory": 314572800,
"CpuQuota": 50000,
"CpuPeriod": 100000,
"CpuShares": 512,
"CpusetCpus": "0,1",
"CpusetMems": "0",
"MemorySwap": 514288000,
"BlkioWeight": 300,
"RestartPolicy": {
"Name": "on-failure",
"MaximumRetryCount": 4
},
"CpuRealtimePeriod": 1000000,
"MemoryReservation": 209715200,
"CpuRealtimeRuntime": 10000
}
{
"Warnings": [
"Published ports are discarded when using host network mode"
]
}
{
"message": "No such container: c2ada9df5af8"
}
{
"message": "Something went wrong."
}
{
"message": "Something went wrong."
}
{
"message": "Something went wrong."
}