<p>Can anyone suggest how can I setup NODE_ENV variable in dockerfile when running a node app.</p>

<p>There a two ways, while building the image or when running the container.</p>

<p><strong>For builds:</strong></p>

<p>Add to your Dockerfile</p>

<pre><code>ENV NODE_ENV=whatEver
</code></pre>

<p>Or use build arguments if you don't want them to stick during runtime
    Docker build --build-args NODE_ENV whatEver</p>

<p><strong>When running:</strong></p>

<p>Run your container with "-e"</p>

<pre><code>docker run -e NODE_ENV=whatever mycontainer
</code></pre>
