<p>I have <a href="/questions/tagged/node.js" class="post-tag" title="show questions tagged &#39;node.js&#39;" rel="tag">node.js</a> application built using <code>Dockerfile</code> that defines:</p>

<pre><code>CMD node dist/bin/index.js
</code></pre>

<p>I'd like to "append" a parameter to the command as it is defined in Dockerfile, i.e. I want to execute the program as <code>node dist/bin/index.js foo</code>.</p>

<p>In <a href="/questions/tagged/docker" class="post-tag" title="show questions tagged &#39;docker&#39;" rel="tag">docker</a> land I am able to achieve this via:</p>

<pre><code>docker build --tag test .
docker run test foo 
</code></pre>

<p>In <a href="/questions/tagged/kubernetes" class="post-tag" title="show questions tagged &#39;kubernetes&#39;" rel="tag"><img src="https://i.stack.imgur.com/8UH0j.png" height="16" width="18" alt="" class="sponsor-tag-img">kubernetes</a> I cannot use <code>command</code> because that will override the <code>ENTRYPOINT</code>. I cannot use <code>args</code> because that will override the <code>cmd</code> defined in the <code>Dockerfile</code>. It appears that my only option is:</p>

<pre><code>cmd: ["node", "dist/bin/index.js", "foo"]
</code></pre>

<p>Is there a way to append an argument to a container command without redefining the entire Docker <code>CMD</code> definition?</p>

<p>No way to append. You can either set the <code>command:</code> or <code>args:</code> on container.spec. You can learn more about how to override CMD/ENTRYPOINT here: <a href="https://kubernetes.io/docs/concepts/configuration/container-command-args/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/configuration/container-command-args/</a></p>
