fn: memory limit adjustments (#746)

1) limit kernel memory which was previously unlimited, using
   same limits as user memory for a unified approach.
2) disable swap memory for containers
This commit is contained in:
Tolga Ceylan
2018-02-07 16:48:52 -08:00
committed by Reed Allman
parent 8b6102f139
commit dc4d90432b

View File

@@ -134,16 +134,18 @@ func (drv *DockerDriver) Prepare(ctx context.Context, task drivers.ContainerTask
container := docker.CreateContainerOptions{ container := docker.CreateContainerOptions{
Name: task.Id(), Name: task.Id(),
Config: &docker.Config{ Config: &docker.Config{
Env: envvars, Env: envvars,
Cmd: cmd, Cmd: cmd,
Memory: int64(task.Memory()), Memory: int64(task.Memory()),
CPUShares: drv.conf.CPUShares, MemorySwap: int64(task.Memory()), // disables swap
Hostname: drv.hostname, KernelMemory: int64(task.Memory()),
Image: task.Image(), CPUShares: drv.conf.CPUShares,
Volumes: map[string]struct{}{}, Hostname: drv.hostname,
OpenStdin: true, Image: task.Image(),
AttachStdin: true, Volumes: map[string]struct{}{},
StdinOnce: true, OpenStdin: true,
AttachStdin: true,
StdinOnce: true,
}, },
HostConfig: &docker.HostConfig{}, HostConfig: &docker.HostConfig{},
Context: ctx, Context: ctx,