Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Commit

Permalink
fix volume permission with cgroup v2
Browse files Browse the repository at this point in the history
  • Loading branch information
h0tw1r3 committed Jun 13, 2022
1 parent 2efea2f commit 62b97ba
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lxc/lxc.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,11 @@ func (d *Driver) mountVolumes(c *lxc.Container, cfg *drivers.TaskConfig, taskCon
}

for _, cgroupDev := range devCgroupAllows {
if err := c.SetConfigItem("lxc.cgroup.devices.allow", cgroupDev); err != nil {
return fmt.Errorf("error setting cgroup permission %q error: %v", cgroupDev, err)
// Try unified, fallback to legacy
if err := c.SetConfigItem("lxc.cgroup2.devices.allow", cgroupDev); err != nil {
if err := c.SetConfigItem("lxc.cgroup.devices.allow", cgroupDev); err != nil {
return fmt.Errorf("error setting cgroup permission %q error: %v", cgroupDev, err)
}
}
}

Expand Down

0 comments on commit 62b97ba

Please sign in to comment.