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),