Allow setting ulimits for containers

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
Brian Goff
2015-02-25 19:37:43 -05:00
parent 321f4f0683
commit 3f39050637
16 changed files with 365 additions and 10 deletions
@@ -51,6 +51,12 @@ You can still call an old version of the API using
**New!**
This endpoint now returns `Os`, `Arch` and `KernelVersion`.
`POST /containers/create`
`POST /containers/(id)/start`
**New!**
You can set ulimit settings to be used within the container.
## v1.17
### Full Documentation
@@ -86,7 +92,6 @@ root filesystem as read only.
**New!**
This endpoint returns a live stream of a container's resource usage statistics.
## v1.16
### Full Documentation
@@ -155,7 +155,8 @@ Create a container
"CapDrop": ["MKNOD"],
"RestartPolicy": { "Name": "", "MaximumRetryCount": 0 },
"NetworkMode": "bridge",
"Devices": []
"Devices": [],
"Ulimits": [{}]
}
}
@@ -244,6 +245,9 @@ Json Parameters:
- **Devices** - A list of devices to add to the container specified in the
form
`{ "PathOnHost": "/dev/deviceName", "PathInContainer": "/dev/deviceName", "CgroupPermissions": "mrw"}`
- **Ulimits** - A list of ulimits to be set in the container, specified as
`{ "Name": <name>, "Soft": <soft limit>, "Hard": <hard limit> }`, for example:
`Ulimits: { "Name": "nofile", "Soft": 1024, "Hard", 2048 }}`
Query Parameters:
@@ -337,7 +341,8 @@ Return low-level information on the container `id`
"Name": "on-failure"
},
"SecurityOpt": null,
"VolumesFrom": null
"VolumesFrom": null,
"Ulimits": [{}]
},
"HostnamePath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hostname",
"HostsPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hosts",
+26
View File
@@ -109,6 +109,7 @@ expect an integer, and they can only be specified once.
--tlskey="~/.docker/key.pem" Path to TLS key file
--tlsverify=false Use TLS and verify the remote
-v, --version=false Print version information and quit
--default-ulimit=[] Set default ulimit settings for containers.
Options with [] may be specified multiple times.
@@ -404,6 +405,14 @@ This will only add the proxy and authentication to the Docker daemon's requests
your `docker build`s and running containers will need extra configuration to use
the proxy
### Default Ulimits
`--default-ulimit` allows you to set the default `ulimit` options to use for all
containers. It takes the same options as `--ulimit` for `docker run`. If these
defaults are not set, `ulimit` settings will be inheritted, if not set on
`docker run`, from the Docker daemon. Any `--ulimit` options passed to
`docker run` will overwrite these defaults.
### Miscellaneous options
IP masquerading uses address translation to allow containers without a public IP to talk
@@ -1974,6 +1983,23 @@ You can add other hosts into a container's `/etc/hosts` file by using one or mor
> $ alias hostip="ip route show 0.0.0.0/0 | grep -Eo 'via \S+' | awk '{ print \$2 }'"
> $ docker run --add-host=docker:$(hostip) --rm -it debian
### Setting ulimits in a container
Since setting `ulimit` settings in a container requires extra privileges not
available in the default container, you can set these using the `--ulimit` flag.
`--ulimit` is specified with a soft and hard limit as such:
`<type>=<soft limit>[:<hard limit>]`, for example:
```
$ docker run --ulimit nofile=1024:1024 --rm debian ulimit -n
1024
```
>**Note:**
> If you do not provide a `hard limit`, the `soft limit` will be used for both
values. If no `ulimits` are set, they will be inherited from the default `ulimits`
set on the daemon.
## save
Usage: docker save [OPTIONS] IMAGE [IMAGE...]