fix(compose): support cgroup_parent and cgroup service fields - #5230
Merged
AkihiroSuda merged 1 commit intoOct 2, 2026
Merged
Conversation
addemod
marked this pull request as ready for review
September 25, 2026 13:58
Contributor
Author
|
This invalidates PR #5227 |
Member
|
Please squash the commits |
Pass cgroup_parent and cgroup through to nerdctl run as --cgroup-parent and --cgroupns, which compose previously ignored. Signed-off-by: Adam Clettborn <a.clettborn@gmail.com>
addemod
force-pushed
the
fix/compose-cgroup-parent
branch
from
September 30, 2026 19:36
e70b09c to
702389a
Compare
Contributor
Author
@AkihiroSuda Done! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
nerdctl composeignores thecgroup_parentandcgroupservice fields, whichnerdctl runsupports as--cgroup-parentand--cgroupns:The service still starts, in the default cgroup parent.
cgroup: hostis dropped the same way and the container keeps a private cgroup namespace. Forcgroup_parentthat means the container runs outside the resource limits the parent was meant to apply, with only a warning.Cause
compose-go loads both fields, but the service parser never maps them to run arguments, and neither is in its list of known fields.
docs/compose.mdlistscgroup_parentas unimplemented.Fix
Map them in the service parser:
services.<SERVICE>.cgroup_parent->--cgroup-parentservices.<SERVICE>.cgroup->--cgroupnsBoth are added to the known-field list, so the warning goes away.
cgroup_parentis removed from the unimplemented list indocs/compose.md.Verification
Built from this branch and from its merge base with main, and run with
nerdctl compose upusing the systemd cgroup driver on cgroup v2, containerd 2.2.1 and runc 1.3.3. The cgroup was read from/proc/<pid>/cgroup, and the namespace was compared against the host's/proc/self/ns/cgroup./system.slice/nerdctl-<id>.scope, private nscgroup_parent: rcs-thirdparty.slice/system.slice/nerdctl-<id>.scope,Ignoring: [CgroupParent]/rcs.slice/rcs-thirdparty.slice/nerdctl-<id>.scopecgroup: hostIgnoring: [Cgroup]cgroup: privateIgnoring: [Cgroup]Test
TestParseCgroupasserts that both fields become--cgroupns=hostand--cgroup-parent=foo.slice.