title: How to use environment variables in CMD for ENTRYPOINT arguments in Dockerfile?
body: <p>I have a Dockerfile where I start a executable with default arguments like this:</p>
  <pre><code>ENTRYPOINT [&quot;executable&quot;, &quot;cmd&quot;]
  CMD [&quot;--param1=1&quot;, &quot;--param2=2&quot;]
  </code></pre>
  <p>This works fine and I can run the container with default arguments:</p>
  <pre><code>docker run image_name
  </code></pre>
  <p>or with custom arguments:</p>
  <pre><code>docker run image_name --param1=a --param2=2
  </code></pre>
  <p>Now i would like to have a default parameter depend on a environment variable or default to the deafult value (1) like this:</p>
  <pre><code>--param1='${PARAM1:-1}'
  </code></pre>
  <p>I Understand that</p>
  <pre><code>ENTRYPOINT [&quot;executable&quot;, &quot;cmd&quot;]
  CMD [&quot;--param1='${PARAM1:-1}'&quot;, &quot;--param2=2&quot;]
  </code></pre>
  <p>does not work since CMD is in <strong>exec form</strong> and does not invoke a command shell and cannot substitute environment variables.</p>
  <p>But if I use CMD in <strong>shell form</strong>:</p>
  <pre><code>ENTRYPOINT [&quot;executable&quot;, &quot;cmd&quot;]
  CMD &quot;--param1='${PARAM1:-1}' --param2=2&quot;
  </code></pre>
  <p>I get <code>no such option: -c</code></p>
  <p>So my question is:</p>
  <p>How get I archive environment variable substitution within the default arguments in CMD for my ENTRYPOINT?</p>