Skip to content

Commit

Permalink
Merge pull request #1480 from hashicorp/b-docker-disable-swap
Browse files Browse the repository at this point in the history
Disable swap on docker driver
  • Loading branch information
dadgar committed Jul 28, 2016
2 parents 0ba27fb + 402d69b commit 1b94f5c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions client/driver/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),

Expand Down

0 comments on commit 1b94f5c

Please sign in to comment.