Merge branch 'master' into weekly
diff --git a/Dockerfile b/Dockerfile
index c84b2d3..48f978a 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -30,7 +30,6 @@
   && echo "$JENKINS_SHA /usr/share/jenkins/jenkins.war" | sha1sum -c -
 
 ENV JENKINS_UC https://updates.jenkins-ci.org
-ENV JENKINS_UC_DOWNLOAD $JENKINS_UC/download
 RUN chown -R jenkins "$JENKINS_HOME" /usr/share/jenkins/ref
 
 # for main web interface:
@@ -39,8 +38,7 @@
 # will be used by attached slave agents:
 EXPOSE 50000
 
-ENV COPY_REFERENCE_FILE_LOG /var/log/copy_reference_file.log
-RUN touch $COPY_REFERENCE_FILE_LOG && chown jenkins.jenkins $COPY_REFERENCE_FILE_LOG
+ENV COPY_REFERENCE_FILE_LOG $JENKINS_HOME/copy_reference_file.log
 
 USER jenkins
 
diff --git a/README.md b/README.md
index eed7542..0ded947 100644
--- a/README.md
+++ b/README.md
@@ -12,24 +12,24 @@
 # Usage
 
 ```
-docker run -p 8080:8080 jenkins
+docker run -p 8080:8080 -p 50000:50000 jenkins
 ```
 
 This will store the workspace in /var/jenkins_home. All Jenkins data lives in there - including plugins and configuration.
 You will probably want to make that a persistent volume (recommended):
 
 ```
-docker run -p 8080:8080 -v /your/home:/var/jenkins_home jenkins
+docker run -p 8080:8080 -p 50000:50000 -v /your/home:/var/jenkins_home jenkins
 ```
 
-This will store the jenkins data in /your/home on the host.
-Ensure that /your/home is accessible by the jenkins user in container (jenkins user - uid 1000).
+This will store the jenkins data in `/your/home` on the host.
+Ensure that `/your/home` is accessible by the jenkins user in container (jenkins user - uid 1000) or use `-u some_other_user` parameter with `docker run`.
 
 
 You can also use a volume container:
 
 ```
-docker run --name myjenkins -p 8080:8080 -v /var/jenkins_home jenkins
+docker run --name myjenkins -p 8080:8080 -p 50000:50000 -v /var/jenkins_home jenkins
 ```
 
 Then myjenkins container has the volume (please do read about docker volume handling to find out more).
@@ -44,6 +44,23 @@
 If your volume is inside a container - you can use ```docker cp $ID:/var/jenkins_home``` command to extract the data.
 Note that some symlinks on some OSes may be converted to copies (this can confuse jenkins with lastStableBuild links etc)
 
+# Setting the number of executors
+
+You can specify and set the number of executors of your Jenkins master instance using a groovy script. By default its set to 2 executors, but you can extend the image and change it to your desired number of executors :
+
+```
+# executors.groovy
+Jenkins.instance.setNumExecutors(5)
+```
+
+and `Dockerfile`
+
+```
+FROM jenkins
+COPY executors.groovy /usr/share/jenkins/ref/init.groovy.d/executors.groovy
+```
+
+
 # Attaching build executors
 
 You can run builds on the master (out of the box) but if you want to attach build slave servers: make sure you map the port: ```-p 50000:50000``` - which will be used when you connect a slave agent.
@@ -56,7 +73,7 @@
 variable for this purpose :
 
 ```
-docker run --name myjenkins -p 8080:8080 --env JAVA_OPTS=-Dhudson.footerURL=http://mycompany.com jenkins
+docker run --name myjenkins -p 8080:8080 -p 50000:50000 --env JAVA_OPTS=-Dhudson.footerURL=http://mycompany.com jenkins
 ```
 
 # Passing Jenkins launcher parameters
diff --git a/plugins.sh b/plugins.sh
index f597a12..3413ce4 100755
--- a/plugins.sh
+++ b/plugins.sh
@@ -19,5 +19,9 @@
     [[ ${plugin[0]} =~ ^\s*$ ]] && continue
     [[ -z ${plugin[1]} ]] && plugin[1]="latest"
     echo "Downloading ${plugin[0]}:${plugin[1]}"
-    curl -s -L -f ${JENKINS_UC_DOWNLOAD}/plugins/${plugin[0]}/${plugin[1]}/${plugin[0]}.hpi -o $REF/${plugin[0]}.jpi
+
+    if [ -z "$JENKINS_UC_DOWNLOAD" ]; then
+      JENKINS_UC_DOWNLOAD=$JENKINS_UC/download
+    fi
+    curl -sSL -f ${JENKINS_UC_DOWNLOAD}/plugins/${plugin[0]}/${plugin[1]}/${plugin[0]}.hpi -o $REF/${plugin[0]}.jpi
 done  < $1