Allow overriding number of executors
diff --git a/Dockerfile b/Dockerfile
index f40bc67..eb1b68e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -23,7 +23,7 @@
 # `/usr/share/jenkins/ref/` contains all reference configuration we want 
 # to set on a fresh new installation. Use it to bundle additional plugins 
 # or config file with your custom jenkins Docker image.
-RUN mkdir -p /usr/share/jenkins/ref/init.groovy.d
+RUN mkdir -p /usr/share/jenkins/ref/init.groovy.d; chown ${uid}:${gid} /usr/share/jenkins/ref/init.groovy.d
 
 ENV TINI_VERSION 0.9.0
 ENV TINI_SHA fa23d1e20732501c3bb8eeeca423c89ac80ed452
diff --git a/jenkins.sh b/jenkins.sh
index df1531d..a717795 100755
--- a/jenkins.sh
+++ b/jenkins.sh
@@ -5,6 +5,11 @@
 echo "--- Copying files at $(date)" >> "$COPY_REFERENCE_FILE_LOG"
 find /usr/share/jenkins/ref/ -type f -exec bash -c ". /usr/local/bin/jenkins-support; copy_reference_file '{}'" \;
 
+cat << EOF >>/usr/share/jenkins/ref/init.groovy.d/executors.groovy
+import jenkins.model.*
+Jenkins.instance.setNumExecutors(${JENKINS_NUM_EXECUTORS:-2})
+EOF
+
 # if `docker run` first argument start with `--` the user is passing jenkins launcher arguments
 if [[ $# -lt 1 ]] || [[ "$1" == "--"* ]]; then
   eval "exec java $JAVA_OPTS -jar /usr/share/jenkins/jenkins.war $JENKINS_OPTS \"\$@\""