From 2999c12ef1faab5c409546e3fa2e0aba36389bf6 Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Thu, 28 Jul 2016 12:17:00 -0700 Subject: [PATCH] disable swap --- client/driver/docker.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/driver/docker.go b/client/driver/docker.go index e9e321e5a..9bb277e7e 100644 --- a/client/driver/docker.go +++ b/client/driver/docker.go @@ -386,10 +386,11 @@ func (d *DockerDriver) createContainer(ctx *ExecContext, task *structs.Task, OpenStdin: driverConfig.Interactive, } + memLimit := int64(task.Resources.MemoryMB) * 1024 * 1024 hostConfig := &docker.HostConfig{ // Convert MB to bytes. This is an absolute value. - Memory: int64(task.Resources.MemoryMB) * 1024 * 1024, - MemorySwap: -1, + Memory: memLimit, + MemorySwap: memLimit, // MemorySwap is memory + swap. // Convert Mhz to shares. This is a relative value. CPUShares: int64(task.Resources.CPU),