Skip to content
This repository has been archived by the owner on Jan 4, 2022. It is now read-only.

pkg/nspawntool: use transient scope to fix device cgroups issues #328

Merged
merged 1 commit into from
Nov 28, 2018

Conversation

dongsupark
Copy link
Member

Starting from systemd v239, it's no more possible to create device nodes inside systemd-nspawn containers, because systemd-nspawn creates subcgroups for each machine slice under /sys/fs/cgroup/devices.

To make docker containers inside nspawn containers capable of creating devices, we need to do workaround. Let's pass --keep-unit to systemd-nspawn, and call systemd-run --scope for using the cni-spawn wrapper. Then the transient scope gets created with a proper DevicePolicy property for each invocation, printing out the CNI result to stdout like before. That way, we can avoid dealing with additional unit files to allow device creation.

Fixes #324

Starting from systemd v239, it's no more possible to create device nodes
inside systemd-nspawn containers, because systemd-nspawn creates
subcgroups for each machine slice under `/sys/fs/cgroup/devices`.

To make docker containers inside nspawn containers capable of creating
devices, we need to do workaround. Let's pass `--keep-unit` to
systemd-nspawn, and call `systemd-run --scope` for using the cni-spawn
wrapper. Then the transient scope gets created with a proper
`DevicePolicy` property for each invocation, printing out the CNI result
to stdout like before. That way, we can avoid dealing with additional
unit files to allow device creation.

Fixes #324
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant