title: How to specify run arguments for a docker container running on kubernetes
body: <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>