mirror of https://github.com/docker/docs.git
update docs for memory and memoryswap
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
parent
72f356be6a
commit
0c0f0d5ab4
|
@ -27,6 +27,7 @@ docker-create - Create a new container
|
||||||
[**--link**[=*[]*]]
|
[**--link**[=*[]*]]
|
||||||
[**--lxc-conf**[=*[]*]]
|
[**--lxc-conf**[=*[]*]]
|
||||||
[**-m**|**--memory**[=*MEMORY*]]
|
[**-m**|**--memory**[=*MEMORY*]]
|
||||||
|
[**--memory-swap**[=*MEMORY-SWAP*]]
|
||||||
[**--mac-address**[=*MAC-ADDRESS*]]
|
[**--mac-address**[=*MAC-ADDRESS*]]
|
||||||
[**--name**[=*NAME*]]
|
[**--name**[=*NAME*]]
|
||||||
[**--net**[=*"bridge"*]]
|
[**--net**[=*"bridge"*]]
|
||||||
|
@ -110,6 +111,18 @@ IMAGE [COMMAND] [ARG...]
|
||||||
**-m**, **--memory**=""
|
**-m**, **--memory**=""
|
||||||
Memory limit (format: <number><optional unit>, where unit = b, k, m or g)
|
Memory limit (format: <number><optional unit>, where unit = b, k, m or g)
|
||||||
|
|
||||||
|
Allows you to constrain the memory available to a container. If the host
|
||||||
|
supports swap memory, then the **-m** memory setting can be larger than physical
|
||||||
|
RAM. If a limit of 0 is specified (not using **-m**), the container's memory is
|
||||||
|
not limited. The actual limit may be rounded up to a multiple of the operating
|
||||||
|
system's page size (the value would be very large, that's millions of trillions).
|
||||||
|
|
||||||
|
**--memory-swap**=""
|
||||||
|
Total memory limit (memory + swap)
|
||||||
|
|
||||||
|
Set `-1` to disable swap (format: <number><optional unit>, where unit = b, k, m or g).
|
||||||
|
This value should always larger than **-m**, so you should alway use this with **-m**.
|
||||||
|
|
||||||
**--mac-address**=""
|
**--mac-address**=""
|
||||||
Container MAC address (e.g. 92:d0:c6:0a:29:33)
|
Container MAC address (e.g. 92:d0:c6:0a:29:33)
|
||||||
|
|
||||||
|
@ -142,7 +155,7 @@ IMAGE [COMMAND] [ARG...]
|
||||||
Give extended privileges to this container. The default is *false*.
|
Give extended privileges to this container. The default is *false*.
|
||||||
|
|
||||||
**--read-only**=*true*|*false*
|
**--read-only**=*true*|*false*
|
||||||
Mount the container's root filesystem as read only.
|
Mount the container's root filesystem as read only.
|
||||||
|
|
||||||
**--restart**=""
|
**--restart**=""
|
||||||
Restart policy to apply when a container exits (no, on-failure[:max-retry], always)
|
Restart policy to apply when a container exits (no, on-failure[:max-retry], always)
|
||||||
|
|
|
@ -186,16 +186,16 @@ which interface and port to use.
|
||||||
Memory limit (format: <number><optional unit>, where unit = b, k, m or g)
|
Memory limit (format: <number><optional unit>, where unit = b, k, m or g)
|
||||||
|
|
||||||
Allows you to constrain the memory available to a container. If the host
|
Allows you to constrain the memory available to a container. If the host
|
||||||
supports swap memory, then the -m memory setting can be larger than physical
|
supports swap memory, then the **-m** memory setting can be larger than physical
|
||||||
RAM. If a limit of 0 is specified, the container's memory is not limited. The
|
RAM. If a limit of 0 is specified (not using **-m**), the container's memory is
|
||||||
actual limit may be rounded up to a multiple of the operating system's page
|
not limited. The actual limit may be rounded up to a multiple of the operating
|
||||||
size, if it is not already. The memory limit should be formatted as follows:
|
system's page size (the value would be very large, that's millions of trillions).
|
||||||
`<number><optional unit>`, where unit = b, k, m or g.
|
|
||||||
|
|
||||||
**--memory-swap**=""
|
**--memory-swap**=""
|
||||||
Total memory usage (memory + swap)
|
Total memory limit (memory + swap)
|
||||||
|
|
||||||
Set '-1' to disable swap (format: <number><optional unit>, where unit = b, k, m or g)
|
Set `-1` to disable swap (format: <number><optional unit>, where unit = b, k, m or g).
|
||||||
|
This value should always larger than **-m**, so you should alway use this with **-m**.
|
||||||
|
|
||||||
**--mac-address**=""
|
**--mac-address**=""
|
||||||
Container MAC address (e.g. 92:d0:c6:0a:29:33)
|
Container MAC address (e.g. 92:d0:c6:0a:29:33)
|
||||||
|
|
|
@ -177,7 +177,8 @@ Json Parameters:
|
||||||
for the container.
|
for the container.
|
||||||
- **User** - A string value containg the user to use inside the container.
|
- **User** - A string value containg the user to use inside the container.
|
||||||
- **Memory** - Memory limit in bytes.
|
- **Memory** - Memory limit in bytes.
|
||||||
- **MemorySwap**- Total memory usage (memory + swap); set `-1` to disable swap.
|
- **MemorySwap**- Total memory limit (memory + swap); set `-1` to disable swap,
|
||||||
|
always use this with `memory`, and make the value larger than `memory`.
|
||||||
- **CpuShares** - An integer value containing the CPU Shares for container
|
- **CpuShares** - An integer value containing the CPU Shares for container
|
||||||
(ie. the relative weight vs othercontainers).
|
(ie. the relative weight vs othercontainers).
|
||||||
**CpuSet** - String value containg the cgroups Cpuset to use.
|
**CpuSet** - String value containg the cgroups Cpuset to use.
|
||||||
|
|
|
@ -310,13 +310,26 @@ The operator can also adjust the performance parameters of the
|
||||||
container:
|
container:
|
||||||
|
|
||||||
-m="": Memory limit (format: <number><optional unit>, where unit = b, k, m or g)
|
-m="": Memory limit (format: <number><optional unit>, where unit = b, k, m or g)
|
||||||
|
-memory-swap="": Total memory limit (memory + swap, format: <number><optional unit>, where unit = b, k, m or g)
|
||||||
-c=0 : CPU shares (relative weight)
|
-c=0 : CPU shares (relative weight)
|
||||||
|
|
||||||
The operator can constrain the memory available to a container easily
|
We have four ways to set memory usage:
|
||||||
with `docker run -m`. If the host supports swap memory, then the `-m`
|
- memory=inf, memory-swap=inf (not specify any of them)
|
||||||
memory setting can be larger than physical RAM.
|
There is no memory limit, you can use as much as you want.
|
||||||
|
|
||||||
Similarly the operator can increase the priority of this container with
|
- memory=L<inf, memory-swap=inf (specify memory and set memory-swap as `-1`)
|
||||||
|
It is not allowed to use more than L bytes of memory, but use as much swap
|
||||||
|
as you want (only if the host supports swap memory).
|
||||||
|
|
||||||
|
- memory=L<inf, memory-swap=2*L (specify memory without memory-swap)
|
||||||
|
It is not allowed to use more than L bytes of memory, swap *plus* memory
|
||||||
|
usage is double of that.
|
||||||
|
|
||||||
|
- memory=L<inf, memory-swap=S<inf, L<=S (specify both memory and memory-swap)
|
||||||
|
It is not allowed to use more than L bytes of memory, swap *plus* memory
|
||||||
|
usage is limited by S.
|
||||||
|
|
||||||
|
The operator can increase the priority of this container with
|
||||||
the `-c` option. By default, all containers run at the same priority and
|
the `-c` option. By default, all containers run at the same priority and
|
||||||
get the same proportion of CPU cycles, but you can tell the kernel to
|
get the same proportion of CPU cycles, but you can tell the kernel to
|
||||||
give more shares of CPU time to one or more containers when you start
|
give more shares of CPU time to one or more containers when you start
|
||||||
|
|
Loading…
Reference in New Issue