Set LDAP_NOFILE to setup a custom ulimit
diff --git a/image/environment/default.startup.yaml b/image/environment/default.startup.yaml
index 1c413d5..6a027d4 100644
--- a/image/environment/default.startup.yaml
+++ b/image/environment/default.startup.yaml
@@ -56,6 +56,9 @@
# Remove config after setup
LDAP_REMOVE_CONFIG_AFTER_SETUP: true
+# Ulimit
+LDAP_NOFILE: 1024
+
# ssl-helper environment variables prefix
LDAP_SSL_HELPER_PREFIX: ldap # ssl-helper first search config from LDAP_SSL_HELPER_* variables, before SSL_HELPER_* variables.
diff --git a/image/service/slapd/process.sh b/image/service/slapd/process.sh
index 7bf3413..4fc5414 100755
--- a/image/service/slapd/process.sh
+++ b/image/service/slapd/process.sh
@@ -7,6 +7,6 @@
# Reduce maximum number of number of open file descriptors to 1024
# otherwise slapd consumes two orders of magnitude more of RAM
# see https://github.com/docker/docker/issues/8231
-ulimit -n 1024
+ulimit -n $LDAP_NOFILE
exec /usr/sbin/slapd -h "ldap://$HOSTNAME ldaps://$HOSTNAME ldapi:///" -u openldap -g openldap -d $LDAP_LOG_LEVEL
diff --git a/image/service/slapd/startup.sh b/image/service/slapd/startup.sh
index 702d906..c9bfc7b 100755
--- a/image/service/slapd/startup.sh
+++ b/image/service/slapd/startup.sh
@@ -8,7 +8,7 @@
# Reduce maximum number of number of open file descriptors to 1024
# otherwise slapd consumes two orders of magnitude more of RAM
# see https://github.com/docker/docker/issues/8231
-ulimit -n 1024
+ulimit -n $LDAP_NOFILE
# create dir if they not already exists
[ -d /var/lib/ldap ] || mkdir -p /var/lib/ldap