Conform to [dockerfile best practices](https://docs.docker.com/articles/dockerfile_best-practices/#entrypoint) to let user run alternate command
but still detect user passing jenkins launcher custom arguments
default usage
➜ docker run --rm -it jenkins
Running from: /usr/share/jenkins/jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
Oct 07, 2014 12:06:48 PM winstone.Logger logInternal
INFO: Beginning extraction from war file
...
detect jenkins launcher arguments
➜ docker run --rm -it jenkins --version
Running from: /usr/share/jenkins/jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
1.565.3
run alternate command
➜ docker run --rm -it jenkins bash
jenkins@24c6215c8492:/$
diff --git a/jenkins.sh b/jenkins.sh
index 4bb7a77..7cb355f 100755
--- a/jenkins.sh
+++ b/jenkins.sh
@@ -1,4 +1,10 @@
#! /bin/bash
-exec java $JAVA_OPTS -jar /usr/share/jenkins/jenkins.war $JENKINS_OPTS --prefix=$JENKINS_PREFIX $@
+# if `docker run` first argument start with `--` the user is passing jenkins launcher arguments
+if [[ $# -lt 1 ]] || [[ "$1" == "--"* ]]; then
+ exec java $JAVA_OPTS -jar /usr/share/jenkins/jenkins.war $JENKINS_OPTS --prefix=$JENKINS_PREFIX $@
+fi
+
+# As argument is not jenkins, assume user want to run his own process, for sample a `bash` shell to explore this image
+exec $@