Merge pull request #1480 from hashicorp/b-docker-disable-swap

Disable swap on docker driver
This commit is contained in:
Alex Dadgar 2016-07-28 13:16:22 -07:00 committed by GitHub
commit 460fb404b4

View file

@ -386,10 +386,11 @@ func (d *DockerDriver) createContainer(ctx *ExecContext, task *structs.Task,
OpenStdin: driverConfig.Interactive, OpenStdin: driverConfig.Interactive,
} }
memLimit := int64(task.Resources.MemoryMB) * 1024 * 1024
hostConfig := &docker.HostConfig{ hostConfig := &docker.HostConfig{
// Convert MB to bytes. This is an absolute value. // Convert MB to bytes. This is an absolute value.
Memory: int64(task.Resources.MemoryMB) * 1024 * 1024, Memory: memLimit,
MemorySwap: -1, MemorySwap: memLimit, // MemorySwap is memory + swap.
// Convert Mhz to shares. This is a relative value. // Convert Mhz to shares. This is a relative value.
CPUShares: int64(task.Resources.CPU), CPUShares: int64(task.Resources.CPU),