<p>I am kind of stuck with running a docker container as part of a kubernetes job and specifying runtime arguments in the job template.</p>
<p>My Dockerfile specifies an entrypoint and no CMD directive:</p>
<pre><code>ENTRYPOINT [&quot;python&quot;, &quot;script.py&quot;]
</code></pre>
<p>From what I understand, this means that when running the docker image and specifying arguments, the container will run using the entrypoint specified in the Dockerfile and pass the arguments to it. I can confirm that this is actually working, because running the container using docker does the trick:</p>
<pre><code>docker run --rm image -e foo -b bar
</code></pre>
<p>In my case this will start script.py, which is using argument parser to parse named arguments, with the intended arguments.</p>
<p>The problem starts to arise when I am using a kubernetes job to do the same:</p>
<pre><code>apiVersion: batch/v1
kind: Job
metadata:
  name: pipeline
spec:
  template:
    spec:
      containers:
      - name: pipeline
        image: test
        args: [&quot;-e&quot;, &quot;foo&quot;, &quot;-b&quot;, &quot;bar&quot;]
</code></pre>
<p>In the pod that gets deployed the correct entrypoint will be run, but the specified arguments vanish. I also tried specifying the arguments like this:</p>
<pre><code>args: [&quot;-e foo&quot;, &quot;-b bar&quot;]
</code></pre>
<p>But this didn't help either. I don't know why this is not working, because the <a href="https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/" rel="nofollow noreferrer">documentation</a> cleary states that: &quot;If you supply only args for a Container, the default Entrypoint defined in the Docker image is run with the args that you supplied.&quot;. The default entrypoint is running, that is correct, but the arguments are lost between kubernetes and docker.</p>
<p>Does somebody know what I am doing wrong?</p>

mike
<p>I actually got it working using the following yaml syntax:</p>
<pre><code>args: 
- &quot;-e&quot;
- &quot;foo&quot;
- &quot;-b&quot;
- &quot;bar&quot; 
</code></pre>
<p>The array syntax that I used beforehand seems not to be working at all as everything was passed to the -e argument of my script like this:</p>
<pre><code>-e &quot; foo -b bar&quot;
</code></pre>
<p>That's why the <code>-b</code> argument was marked as missing even though the arguments were populated in the container.</p>
