From c2284962c798a11f3c956ee237f27cfd3b0fcb21 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Mon, 15 Jul 2019 16:44:56 -0400 Subject: Add support for launching containers without CGroups This is mostly used with Systemd, which really wants to manage CGroups itself when managing containers via unit file. Signed-off-by: Matthew Heon --- pkg/spec/spec.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'pkg/spec/spec.go') diff --git a/pkg/spec/spec.go b/pkg/spec/spec.go index 44bbda885..38f9c7306 100644 --- a/pkg/spec/spec.go +++ b/pkg/spec/spec.go @@ -396,6 +396,18 @@ func (config *CreateConfig) createConfigToOCISpec(runtime *libpod.Runtime, userM } } + switch config.Cgroups { + case "disabled": + if addedResources { + return nil, errors.New("cannot specify resource limits when cgroups are disabled is specified") + } + configSpec.Linux.Resources = &spec.LinuxResources{} + case "enabled", "": + // Do nothing + default: + return nil, errors.New("unrecognized option for cgroups; supported are 'default' and 'disabled'") + } + // Add annotations if configSpec.Annotations == nil { configSpec.Annotations = make(map[string]string) -- cgit v1.2.3-54-g00ecf