title: Docker ENTRYPOINT with ENV variable and optional arguments
body: <p>I have a Dockerfile with an ENTRYPOINT that uses an ENV variable. I can't get the ENTRYPOINT structured so the container can also accept additional command line arguments. Here is the relevant part of the Dockerfile:</p>
  
  <pre><code>ARG MODULE_NAME
  ENV MODULE_NAME=$MODULE_NAME
  ENTRYPOINT /usr/bin/python3 -m ${MODULE_NAME}
  </code></pre>
  
  <p>That works fine if I just want to launch the container without additional arguments:</p>
  
  <pre><code>docker run my-image
  </code></pre>
  
  <p>But I need to be able to pass additional command line arguments (e.g., a "--debug" flag) to the python process like this:</p>
  
  <pre><code>docker run my-image --debug
  </code></pre>
  
  <p>With the form of ENTRYPOINT above, the "--debug" arg is not passed to the python process. I've tried both the exec form and the shell form of ENTRYPOINT but can't get it to work with both the ENV variable <em>and</em> command line args. A few other forms I tried:</p>
  
  <p>This runs but doesn't accept additional args:</p>
  
  <pre><code>ENTRYPOINT ["/bin/bash", "-c", "/usr/bin/python3 -m ${MODULE_NAME}"]
  </code></pre>
  
  <p>This gives "/usr/bin/python3: No module named  ${MODULE_NAME}":</p>
  
  <pre><code>ENTRYPOINT ["/usr/bin/python3", "-m ${MODULE_NAME}"]
  </code></pre>
  
  <p>This gives "/usr/bin/python3: No module named  ${MODULE_NAME}":</p>
  
  <pre><code>ENTRYPOINT ["/usr/bin/python3", "-m", "${MODULE_NAME}"]
  </code></pre>