فهرست منبع

Merge pull request #24555 from thaJeztah/to-infinity-and-beyond

Don't set ulimits (nproc) for all init scripts
Alexander Morozov 9 سال پیش
والد
کامیت
4084bf7ad2

+ 4 - 1
contrib/init/openrc/docker.initd

@@ -13,7 +13,10 @@ start_pre() {
 	checkpath -f -m 0644 -o root:docker "$DOCKER_LOGFILE"
 
 	ulimit -n 1048576
-	ulimit -u 1048576
+
+	# Having non-zero limits causes performance problems due to accounting overhead
+	# in the kernel. We recommend using cgroups to do container-local accounting.
+	ulimit -u unlimited
 
 	return 0
 }

+ 1 - 1
contrib/init/systemd/docker.service

@@ -11,9 +11,9 @@ Type=notify
 # for containers run by docker
 ExecStart=/usr/bin/dockerd -H fd://
 ExecReload=/bin/kill -s HUP $MAINPID
+LimitNOFILE=1048576
 # Having non-zero Limit*s causes performance problems due to accounting overhead
 # in the kernel. We recommend using cgroups to do container-local accounting.
-LimitNOFILE=infinity
 LimitNPROC=infinity
 LimitCORE=infinity
 # Uncomment TasksMax if your systemd version supports it.

+ 5 - 2
contrib/init/sysvinit-debian/docker

@@ -94,10 +94,13 @@ case "$1" in
 		chgrp docker "$DOCKER_LOGFILE"
 
 		ulimit -n 1048576
+
+		# Having non-zero limits causes performance problems due to accounting overhead
+		# in the kernel. We recommend using cgroups to do container-local accounting.
 		if [ "$BASH" ]; then
-			ulimit -u 1048576
+			ulimit -u unlimited
 		else
-			ulimit -p 1048576
+			ulimit -p unlimited
 		fi
 
 		log_begin_msg "Starting $DOCKER_DESC: $BASE"

+ 5 - 1
contrib/init/upstart/docker.conf

@@ -2,8 +2,12 @@ description "Docker daemon"
 
 start on (filesystem and net-device-up IFACE!=lo)
 stop on runlevel [!2345]
+
 limit nofile 524288 1048576
-limit nproc 524288 1048576
+
+# Having non-zero limits causes performance problems due to accounting overhead
+# in the kernel. We recommend using cgroups to do container-local accounting.
+limit nproc unlimited unlimited
 
 respawn