mirror of https://github.com/docker/compose.git
Merge pull request #9552 from glours/fix-deploy-cpus-issue
Fix deploy cpus issue and support pids limit
This commit is contained in:
commit
57975094cc
|
@ -595,8 +595,12 @@ func setLimits(limits *types.Resource, resources *container.Resources) {
|
|||
resources.Memory = int64(limits.MemoryBytes)
|
||||
}
|
||||
if limits.NanoCPUs != "" {
|
||||
i, _ := strconv.ParseInt(limits.NanoCPUs, 10, 64)
|
||||
resources.NanoCPUs = i
|
||||
if f, err := strconv.ParseFloat(limits.NanoCPUs, 64); err == nil {
|
||||
resources.NanoCPUs = int64(f * 1e9)
|
||||
}
|
||||
}
|
||||
if limits.PIds > 0 {
|
||||
resources.PidsLimit = &limits.PIds
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue