title: How to pass Java_opts before an executable to entrypoint in dockerfile?
body: <p>I am running a scala script with ammonite. I need to pass JAVA_OPTS to limit the memory consumed by ammonite. According to the ammonite <a href="http://ammonite.io/" rel="noreferrer">docs</a>, I can do it by doing<br />
  <code>JAVA_OPTS='-Xmx&lt;limit&gt;' amm &lt;scala script&gt;</code></p>
  <p>Now I want to run this script inside a docker container, which I am doing with like this:</p>
  <pre><code>FROM &lt;open jdk image&gt;
  WORKDIR /opt/docker
  ADD scm-source.json /
  ADD --chown=daemon:daemon deps/amm /opt/docker
  RUN mkdir amm_home &amp;&amp; chown daemon:daemon amm_home
  RUN mkdir data &amp;&amp; chown daemon:daemon data
  ADD --chown=daemon:daemon UserPrefExporter.sc /opt/docker
  USER daemon
  ENTRYPOINT [&quot;./amm&quot;, &quot;-h&quot;, &quot;amm_home&quot;, &quot;UserPrefExporter.sc&quot;]
  </code></pre>
  <p>This runs fine and runs the script. The problem lies in passing the JAVA_OPTS to amm.<br />
  ENTRYPOINT requires first parameter to be the executable but I want to have JAVA_OPTS before amm.</p>
  <p>How to achieve this?</p>