From f316c51faca9adaef2e0564d640d39becd320d48 Mon Sep 17 00:00:00 2001 From: Niam Jen Wei Date: Fri, 12 Jun 2020 20:11:28 +0100 Subject: [PATCH] Fix docker driver MemorySwap value Fixes an incorrect value being assigned to MemorySwap when `memory_hard_limit` flag is being used. Issue raised in https://github.com/hashicorp/nomad/issues/8153 --- drivers/docker/driver.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/docker/driver.go b/drivers/docker/driver.go index 75cde8ac8cc..97e60967be4 100644 --- a/drivers/docker/driver.go +++ b/drivers/docker/driver.go @@ -838,7 +838,7 @@ func (d *Driver) createContainerConfig(task *drivers.TaskConfig, driverConfig *T hostConfig.MemorySwap = 0 hostConfig.MemorySwappiness = nil } else { - hostConfig.MemorySwap = task.Resources.LinuxResources.MemoryLimitBytes // MemorySwap is memory + swap. + hostConfig.MemorySwap = memory // disable swap explicitly in non-Windows environments var swapiness int64 = 0