From e1f54b6c0dd4f28fa89cdfef050a48787da4ca3a Mon Sep 17 00:00:00 2001 From: Nicola Sella Date: Thu, 3 Oct 2024 15:34:55 +0200 Subject: [PATCH] Docker compat: Return null when swappiness is -1 Fixes: https://github.com/containers/podman/issues/23824 Signed-off-by: Nicola Sella --- pkg/api/handlers/compat/containers.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go index bd883bf6f2..dd815388e9 100644 --- a/pkg/api/handlers/compat/containers.go +++ b/pkg/api/handlers/compat/containers.go @@ -486,6 +486,10 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON, } sort.Strings(hc.Binds) + // Docker reports null instead of 0 for unset Swappiness + if *hc.MemorySwappiness == -1 { + hc.MemorySwappiness = nil + } // k8s-file == json-file if hc.LogConfig.Type == define.KubernetesLogging { hc.LogConfig.Type = define.JSONLogging