Up default Podman rlimits to avoid max open files
Every port we open consumes an open FD. This can easily consume
all available FDs for the podman process. Set rlimits to resolve
this.
Closes:
Approved by: rhatdan
@@ -138,6 +138,17 @@ func main() {
logrus.SetLevel(level)
}
+ // Only if not rootless, set rlimits for open files.
+ // We open numerous FDs for ports opened
+ if os.Geteuid() == 0 {
+ rlimits := new(syscall.Rlimit)
+ rlimits.Cur = 1048576
+ rlimits.Max = 1048576
+ if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, rlimits); err != nil {
+ return errors.Wrapf(err, "error setting new rlimits")
+ }
+ }
+
if logLevel == "debug" {
debug = true
