summaryrefslogtreecommitdiff
path: root/cmd/podman/main.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-09-10 17:00:24 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-09-13 17:56:58 +0000
commit9126b45a3f2255b103ef60f305f8ca9ab2805b50 (patch)
tree6c6656498d28b00ef8d58642887f5d7a820f54bd /cmd/podman/main.go
parent70b160ae032b548b3d4456f17f8436b24ea37a15 (diff)
downloadpodman-9126b45a3f2255b103ef60f305f8ca9ab2805b50.tar.gz
podman-9126b45a3f2255b103ef60f305f8ca9ab2805b50.tar.bz2
podman-9126b45a3f2255b103ef60f305f8ca9ab2805b50.zip
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. Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #1437 Approved by: rhatdan
Diffstat (limited to 'cmd/podman/main.go')
-rw-r--r--cmd/podman/main.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/cmd/podman/main.go b/cmd/podman/main.go
index 8d470e10d..48032a20e 100644
--- a/cmd/podman/main.go
+++ b/cmd/podman/main.go
@@ -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