<p>I have a docker image with below entrypoint.</p>
<pre><code>ENTRYPOINT [&quot;sh&quot;, &quot;-c&quot;, &quot;python3 -m myapp ${*}&quot;]
</code></pre>
<p>I tried to pass arguments to this image in my kubernetes deployments so that <code>${*}</code> is replaced with them, but after checking the logs it seem that the first argument was ignored.
I tried to reproduce the result regardless of image, and applied below pod:</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: test
spec:
  containers:
  - name: test
    image: postgres # or any image you may like
    command: [&quot;bash -c /bin/echo ${*}&quot;]
    args: 
      - sth
      - serve
      - arg
</code></pre>
<p>when I check the logs, I just see <code>serve arg</code>, and <code>sth</code> is completely ignored.
Any idea on what went wrong or what should I do to pass arguments to exec-style entrypoints instead?</p>

Soroush Vafaie Tabar
<p>First, your <code>command</code> has quoting problems -- you are effectively running <code>bash -c echo</code>.</p>
<p>Second, you need to closely read the documentation for the <code>-c</code> option (emphasis mine):</p>
<blockquote>
<p>If the <code>-c</code> option is present, then commands are read from
the first non-option argument command_string.  If there
are arguments after the command_string, <strong>the first argument
is assigned to $0</strong> and any remaining arguments are assigned
to the positional parameters.  The assignment to $0 sets
the name of the shell, which is used in warning and error
messages.</p>
</blockquote>
<p>So you want:</p>
<pre><code>command: [&quot;bash&quot;, &quot;-c&quot;, &quot;echo ${*}&quot;, &quot;bash&quot;]
</code></pre>
<p>Given your pod definition, this would set <code>$0</code> to <code>bash</code>, and then <code>$1</code> to <code>sth</code>, <code>$2</code> to <code>serve</code>, and <code>$3</code> to <code>arg</code>.</p>
