diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/spec/spec.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/spec/spec.go b/pkg/spec/spec.go index a915c305f..a2fa169e5 100644 --- a/pkg/spec/spec.go +++ b/pkg/spec/spec.go @@ -444,13 +444,24 @@ func addRlimits(config *CreateConfig, g *generate.Generator) error { err error ) + nofileSet := false + for _, u := range config.Resources.Ulimit { if ul, err = units.ParseUlimit(u); err != nil { return errors.Wrapf(err, "ulimit option %q requires name=SOFT:HARD, failed to be parsed", u) } + if ul.Name == "nofile" { + nofileSet = true + } + g.AddProcessRlimits("RLIMIT_"+strings.ToUpper(ul.Name), uint64(ul.Hard), uint64(ul.Soft)) } + + if !nofileSet { + g.AddProcessRlimits("RLIMIT_NOFILE", 1048576, 1048576) + } + return nil } |