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
1 changed files with 3 additions and 2 deletions

View File

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