Make container memory limit configurable

This commit is contained in:
Marcos Lilljedahl
2017-09-18 17:20:18 -03:00
parent 86f27ee10d
commit a268ad6988
3 changed files with 10 additions and 3 deletions

View File

@@ -288,7 +288,13 @@ func (d *docker) CreateContainer(opts CreateContainerOpts) error {
}
}
h.Resources.PidsLimit = pidsLimit
h.Resources.Memory = 4092 * Megabyte
if memLimit := os.Getenv("MAX_MEMORY_MB"); memLimit != "" {
if i, err := strconv.Atoi(memLimit); err == nil {
h.Resources.Memory = int64(i) * Megabyte
}
}
t := true
h.Resources.OomKillDisable = &t