Skip to content

Commit

Permalink
Skip setting MemorySwap on Windows
Browse files Browse the repository at this point in the history
Windows doesn't support this Docker setting.

Fixes #2193
  • Loading branch information
schmichael committed Feb 21, 2017
1 parent e652510 commit 8c35388
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions client/driver/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -753,8 +753,7 @@ func (d *DockerDriver) createContainerConfig(ctx *ExecContext, task *structs.Tas

hostConfig := &docker.HostConfig{
// Convert MB to bytes. This is an absolute value.
Memory: memLimit,
MemorySwap: memLimit, // MemorySwap is memory + swap.
Memory: memLimit,
// Convert Mhz to shares. This is a relative value.
CPUShares: int64(task.Resources.CPU),

Expand All @@ -764,6 +763,11 @@ func (d *DockerDriver) createContainerConfig(ctx *ExecContext, task *structs.Tas
Binds: binds,
}

// Windows does not support MemorySwap #2193
if runtime.GOOS != "windows" {
hostConfig.MemorySwap = memLimit // MemorySwap is memory + swap.
}

if len(driverConfig.Logging) != 0 {
d.logger.Printf("[DEBUG] driver.docker: Using config for logging: %+v", driverConfig.Logging[0])
hostConfig.LogConfig = docker.LogConfig{
Expand Down

0 comments on commit 8c35388

Please sign in to comment.