-
Notifications
You must be signed in to change notification settings - Fork 18.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use fs cgroups by default #17704
Use fs cgroups by default #17704
Conversation
ping @vishh @crosbymichael |
LGTM 💯 |
With this, all container processes will in the same service or scope with daemon, so users can not control them by systemd commands, isn't that a regression we need to warn systemd users for now? I agree we should allow to set parent systemd slice as I suggested in opencontainers/runc#336 (comment), but are we planning to achieve this with plain filesystem api and eventually remove systemd code for good? I think it'll be much easier to keep some systemd api and share others with cgroupfs. Anyway that's another story. |
@hqhq Yeah, actually I plan to introduce daemon-wide cgroup in next release. Also I think all containers will be in PID 1 cgroup, not daemon cgroup. |
@LK4D4 Agreed, we had proposal for daemon-wide cgroups long time ago, and create containers in root cgroup makes more sense, constraints like |
what is a deamon-wide cgroup? |
@crosbymichael like parent for all containers. There is nothing like this in this pr. |
The parent is /docker/ right? |
@crosbymichael I'm not sure, for me at least device cgroup in |
@LK4D4 @crosbymichael I think daemon-wide cgroup is the cgroup for docker daemon, use it like For example, daemon was in But the problem is systemd cgroup does not work like that, it always put container into |
How about providing a daemon flag which defines the default cgroup root for the daemon? It can default to |
@vishh that's what I had in mind |
LGTM |
@LK4D4: Can you update this PR to also include a daemon level flag for configuring the parent cgroup of all docker containers? |
@vishh I prefer to do it in separate PR, because it'll be mostly docs PR and needed to be reviewed by more people. |
Ok. I just want the configuration to land in the same release. On Mon, Nov 16, 2015 at 10:44 AM, Alexander Morozov <
|
@vishh I'll create issue and add to milestone. |
LGTM |
I think this section needs updating. |
@icecrime Yup, thanks! |
it is not available, the system uses `cgroupfs`. By default, if no option is | ||
specified, the execdriver first tries `systemd` and falls back to `cgroupfs`. | ||
This example sets the execdriver to `cgroupfs`: | ||
it is not available, the system uses `cgroupfs`. By default `cgroupfs` is used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you omit the `native.cgroupdriver` option,` cgroupfs` is used.
Minor nit of cours..I just think that "by default" is confusing as we have lots of instances where flags/options have defaults and we have what the system does when a user doesn't specify the flag/option.
Our implementation of systemd cgroups is mixture of systemd api and plain filesystem api. It's hard to keep it up to date with systemd and it already contains some nasty bugs with new versions. Ideally it should be replaced with some daemon flag which will allow to set parent systemd slice. Signed-off-by: Alexander Morozov <[email protected]>
@moxiegirl I changed your suggestion. |
LGTM |
Thank you @LK4D4 LGTM |
@rhatdan it's not true for my systemd-226, because systemd doesn't put docker in |
How are you starting docker daemon? In the docker.service unit file? |
Bottom line the container processes all end up being in the same scope as the docker daemon. This means if someone changes the cgroups of the docker daemon, all containers will be effected. If some one of the container processes registers with systemd-machine, and then terminates systemd will attempt to kill all processes in the same scope as the container, meaning all processes under the docker daemon. If you run the docker daemon by hand this means all container processes will be in the same scope as your user process. |
@rhatdan Yes, I'm starting with systemd:
|
What does systemd-cgls show? Where is the docker daemon running? Where is the container process running? |
@rhatdan Sorry, seems like I misunderstood what we're talking here about. I thought we're talking about cgroups overall, but everything was about |
Right this is all about the "Scope" which in systemd terms is how it groups like processes together. Each user, service, vm gets its own "Scope". The problem with this change is the Docker container processes no longer get their own "Scope", they share the scope with the docker daemon. |
@rhatdan Yeah, it appeared not so easy, because you can't just remove subscope from systemd cgroup :/ |
I see two sub-issues here:
|
Related issue: #18022 |
@vishh I will add flag tomorrow. However "name=systemd" cgroup seems to be usable only through systemd API. So, I'll appreciate any help on this. In worst case we will be forced to use systemd API even in fs cgroups(only for name=systemd). |
I would hope --cgroup-parent would work. We plan on shipping the docker daemon with the systemd support turned on, since we don't agree with this patch, and feel that this is a breaking behaviour. |
I think what's not really covered well in this thread is the actual
reasoning for the patch. With a newer systemd, the "unified hierarchy" was
enabled, which breaks our already fragile and faked systemd support.
Turning off that fragile implementation is the first step, fixing that
implementation comes next (which @LK4D4 is already working on).
|
Does |
Our implementation of systemd cgroups is mixture of systemd api and
plain filesystem api. It's hard to keep it up to date with systemd and
it already contains some nasty bugs with new versions. Ideally it should
be replaced with some daemon flag which will allow to set parent systemd
slice.