Skip to content

Commit

Permalink
internal/server/instance/lxc: Add support for image.requirements.priv…
Browse files Browse the repository at this point in the history
…ileged

Signed-off-by: Stéphane Graber <[email protected]>
  • Loading branch information
stgraber committed Oct 20, 2023
1 parent 6f8397e commit 42f28d2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/server/instance/drivers/driver_lxc.go
Original file line number Diff line number Diff line change
Expand Up @@ -1916,6 +1916,11 @@ func (d *lxc) startCommon() (string, []func() error, error) {
return "", nil, fmt.Errorf("The image used by this instance requires a CGroupV1 host system")
}

// Ensure privileged is turned off for images that cannot work privileged
if util.IsFalse(d.localConfig["image.requirements.privileged"]) && util.IsTrue(d.expandedConfig["security.privileged"]) {
return "", nil, fmt.Errorf("The image used by this instance is incompatible with privileged containers. Please unset security.privileged on the instance")
}

// Load any required kernel modules
kernelModules := d.expandedConfig["linux.kernel_modules"]
if kernelModules != "" {
Expand Down

0 comments on commit 42f28d2

Please sign in to comment.