From 7fc0299c6f747e124ff52e45e37a6d69184f80d6 Mon Sep 17 00:00:00 2001 From: Thomas Stromberg Date: Tue, 1 Sep 2020 13:57:52 -0700 Subject: [PATCH] Disable swap in Docker/podman by setting --memory-swap to --memory --- pkg/drivers/kic/oci/oci.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/drivers/kic/oci/oci.go b/pkg/drivers/kic/oci/oci.go index f8c0eb2b6aed..788904311c06 100644 --- a/pkg/drivers/kic/oci/oci.go +++ b/pkg/drivers/kic/oci/oci.go @@ -177,9 +177,14 @@ func CreateContainerNode(p CreateParams) error { if p.OCIBinary == Podman && memcgSwap { // swap is required for memory 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 p.OCIBinary == Docker { // swap is only required for --memory-swap + + if p.OCIBinary == Docker { 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)) } // https://www.freedesktop.org/wiki/Software/systemd/ContainerInterface/