mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
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:
committed by
Reed Allman
parent
8b6102f139
commit
dc4d90432b
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user