Skip to content

Support the cgroup service field - #1519

Open
Sanjays2402 wants to merge 2 commits into
containers:mainfrom
Sanjays2402:fix/cgroup-namespace-mode
Open

Support the cgroup service field#1519
Sanjays2402 wants to merge 2 commits into
containers:mainfrom
Sanjays2402:fix/cgroup-namespace-mode

Conversation

@Sanjays2402

Copy link
Copy Markdown

Closes #1439

Contributor Checklist:

The Compose Specification cgroup service field was silently dropped, so cgroup: host still started the container in a private cgroup namespace while docker-compose puts it in the host namespace. It is now mapped to podman run --cgroupns, with any other value rejected the same way the neighbouring ipc option validates its input.

Unit tests added in tests/unit/test_container_to_args.py cover both valid modes and the invalid-value error; they fail without the change and pass with it.

Let me know if you'd like a newsfragments/ entry added for this and I'll push one.

The Compose Specification `cgroup` service field (`host` or `private`)
was silently dropped: `container_to_args` never read it, so a service
declaring `cgroup: host` was started in a private cgroup namespace
while docker-compose puts it in the host namespace.

Map the field onto `podman run --cgroupns`, and reject any other value
with a ValueError, mirroring how the neighbouring `ipc` option is
validated.

Added unit tests covering both valid modes and the invalid-value error.

@p12tic p12tic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks. Please add a release note.

@Sanjays2402

Copy link
Copy Markdown
Author

Added the requested release note in b40659d: newsfragments/cgroup-service-field.feature. It describes the new Compose cgroup service field support and the host/private --cgroupns modes. The focused container_to_args suite is green (80 passed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cgroup: host is silently ignored by podman-compose provider

2 participants