Skip to content

Commit 7f417b5

Browse files
committed
fix: allow all devices on systemd cgroup
Signed-off-by: zwtop <[email protected]>
1 parent aa5acbc commit 7f417b5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

client/runtime.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,9 @@ func containerSpecOpts(namespace string, img containerd.Image, container *model.
493493
specOpts = append(specOpts, oci.WithCPUCFS(container.CPUQuota, container.CPUPeriod))
494494
}
495495
specOpts = append(specOpts, withRlimits(container.Rlimits))
496+
if container.Runtime.SystemdCgroup {
497+
specOpts = append(specOpts, withAllowAllDevices)
498+
}
496499
specOpts = append(specOpts, withSpecPatches(container.SpecPatches))
497500
specOpts = append(specOpts, withRuntimeENV(namespace, container))
498501
return specOpts
@@ -721,3 +724,13 @@ func withRuntimeENV(namespace string, container *model.Container) oci.SpecOpts {
721724
fmt.Sprintf("%s=%s", ENVRuntimeContainerImage, container.Image),
722725
})
723726
}
727+
728+
func withAllowAllDevices(_ context.Context, _ oci.Client, _ *containers.Container, spec *oci.Spec) error {
729+
spec.Linux.Resources.Devices = []specs.LinuxDeviceCgroup{
730+
{
731+
Allow: true,
732+
Access: "rwm",
733+
},
734+
}
735+
return nil
736+
}

0 commit comments

Comments
 (0)