From 61295a1ec838edf2f31b3c55e324979300b26e15 Mon Sep 17 00:00:00 2001 From: Alexander Morozov Date: Mon, 7 Dec 2015 09:55:33 -0800 Subject: [PATCH] Add ability to set cgroup parent for all containers Fix #18022 Signed-off-by: Alexander Morozov --- docs/reference/commandline/daemon.md | 17 +++++++++++++++++ man/docker-daemon.8.md | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/docs/reference/commandline/daemon.md b/docs/reference/commandline/daemon.md index fbcf5583c3..04d6578371 100644 --- a/docs/reference/commandline/daemon.md +++ b/docs/reference/commandline/daemon.md @@ -20,6 +20,7 @@ weight = -1 --authz-plugin=[] Set authorization plugins to load -b, --bridge="" Attach containers to a network bridge --bip="" Specify network bridge IP + --cgroup-parent=/docker Set parent cgroup for all containers -D, --debug Enable debug mode --default-gateway="" Container default gateway IPv4 address --default-gateway-v6="" Container default gateway IPv6 address @@ -643,4 +644,20 @@ set like this: /usr/local/bin/docker daemon -D -g /var/lib/docker -H unix:// > /var/lib/docker-machine/docker.log 2>&1 +# Default cgroup parent +The `--cgroup-parent` option allows you to set the default cgroup parent +to use for containers. If this option is not set, it defaults to `/docker`. + +If the cgroup has a leading forward slash (`/`), the cgroup is created +under the root cgroup, otherwise the cgroup is created under the daemon +cgroup. + +Assuming the daemon is running in cgroup `daemoncgroup`, +`--cgroup-parent=/foobar` creates a cgroup in +`/sys/fs/cgroup/memory/foobar`, wheras using `--cgroup-parent=foobar` +creates the cgroup in `/sys/fs/cgroup/memory/daemoncgroup/foobar` + +This setting can also be set per container, using the `--cgroup-parent` +option on `docker create` and `docker run`, and takes precedence over +the `--cgroup-parent` option on the daemon. diff --git a/man/docker-daemon.8.md b/man/docker-daemon.8.md index 466b80537c..269268a1d1 100644 --- a/man/docker-daemon.8.md +++ b/man/docker-daemon.8.md @@ -10,6 +10,7 @@ docker-daemon - Enable daemon mode [**--authz-plugin**[=*[]*]] [**-b**|**--bridge**[=*BRIDGE*]] [**--bip**[=*BIP*]] +[**--cgroup-parent**[=*/docker*]] [**--cluster-store**[=*[]*]] [**--cluster-advertise**[=*[]*]] [**--cluster-store-opt**[=*map[]*]] @@ -80,6 +81,9 @@ format. **--bip**="" Use the provided CIDR notation address for the dynamically created bridge (docker0); Mutually exclusive of \-b +**--cgroup-parent**="" + Set parent cgroup for all containers. Default is "/docker". + **--cluster-store**="" URL of the distributed storage backend