From eabc02d3c4058be63b44fdce7cd3fe3fa87465d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Thu, 18 Feb 2021 18:48:39 +0100 Subject: [PATCH] Stop using --memory-swap if it is not available With Debian and Ubuntu kernels, it needs to be configured. And now with cgroups v2, it starts throwing errors at run. --- pkg/drivers/kic/oci/oci.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/drivers/kic/oci/oci.go b/pkg/drivers/kic/oci/oci.go index 27f7a49a73b1..e88f5e635e86 100644 --- a/pkg/drivers/kic/oci/oci.go +++ b/pkg/drivers/kic/oci/oci.go @@ -181,8 +181,10 @@ func CreateContainerNode(p CreateParams) error { runArgs = append(runArgs, "--security-opt", "apparmor=unconfined") runArgs = append(runArgs, fmt.Sprintf("--memory=%s", p.Memory)) - // Disable swap by setting the value to match - runArgs = append(runArgs, fmt.Sprintf("--memory-swap=%s", p.Memory)) + if memcgSwap { + // Disable swap by setting the value to match + runArgs = append(runArgs, fmt.Sprintf("--memory-swap=%s", p.Memory)) + } virtualization = "docker" // VIRTUALIZATION_DOCKER }