<p>I am trying to understand how can i pass command line arguments to my java app, the app is containerized in a Docker container which i would like to run from Kubernetes.
Let me show you what i did so far.
The dockerfile:</p>
<pre><code>FROM java:8
WORKDIR /
ADD myApp.jar myApp.jar
COPY entry-point.sh /
RUN chmod +x entry-point.sh
EXPOSE 8080
ENTRYPOINT [&quot;/entry-point.sh&quot;]
</code></pre>
<p>The <code>entry-point.sh</code> has this content:</p>
<pre><code>#!/bin/sh
echo &quot;arguments: $1&quot;
java -jar myApp.jar $1
</code></pre>
<p>The k8s file:</p>
<pre><code>    apiVersion: batch/v1
    metadata:
      name: myapp-test-job
      namespace: myNamespace
    kind: Job
    metadata:
      name: myapp
    spec:
      template:
        metadata:
          labels:
            app: myapp
        spec:
          containers:
          - args:
            - -c
            - /opt/config/configuration.yml
            name: myapp
            image: myapp:latest
            imagePullPolicy: Never
            args:
            volumeMounts:
              - name: config
                mountPath: /opt/config
          restartPolicy: Never
          volumes:
            - name: config
              configMap:
                name: configurations
                items:
                - key: &quot;configuration.yml&quot;
                  path: &quot;configuration.yml&quot;
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: configurations
  namespace: myapp
data:
  configuration.yml: |
    #HERE ALL THE CONFIGS
</code></pre>
<p>The app itself is executed, but it cant find the configuration file, i see the output of the <code>entry-point.sh</code> file: <code>arguments:</code>, but i guess that the argument i am declaring in the kubernetes file are not being passed at all to the entrypoint file, i think this:
<code>ENTRYPOINT [&quot;/entry-point.sh&quot;]</code> format is not the correct one when arguments need to be passed.
Anyone has an advice?</p>

JBoy
<p>Your script only uses the first argument <code>$1</code>.  There's a special variable <code>$@</code> that expands to all the arguments, so you could change the script to:</p>
<pre class="lang-sh prettyprint-override"><code>#!/bin/sh
echo &quot;arguments: $@&quot;
# $@ and not $1; make sure to quote it as well
java -jar myApp.jar &quot;$@&quot;
</code></pre>
<p>If your wrapper script is just passing along its options to some underlying program, it could make sense to dispense with the wrapper script and just make the program be the Docker <code>ENTRYPOINT</code>.  (Or, keep the wrapper if you need to do some initial setup before launching the command.)</p>
<pre class="lang-sh prettyprint-override"><code># The main command to run.  Should be enough to actually run the
# application (don't use just [&quot;java&quot;]).  Must be JSON-array syntax.
ENTRYPOINT [&quot;java&quot;, &quot;-jar&quot;, &quot;myApp.jar&quot;]

# Additional options to the program.  Can be overridden with options
# after the `docker run image-name`, Compose `command:`, or
# Kubernetes `args:`.  Must be JSON-array syntax.
CMD []
# (including the previous line is optional)
</code></pre>
