Skip to content

Commit

Permalink
disable swap
Browse files Browse the repository at this point in the history
  • Loading branch information
dadgar committed Jul 28, 2016
1 parent 59f07a6 commit 402d69b
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 402d69b

Please sign in to comment.