Docker multiple environments : <p>I'm trying to wrap my head around Docker, but I'm having a hard time figuring it out. I tried to implement it in my small project (MERN stack), and I was thinking how do you distinct between development, (maybe staging), and production environments.</p>

<p>I saw one <a href="https://github.com/Hashnode/mern-starter" rel="noreferrer">example</a> where they used 2 Docker files, and 2 docker-compose files, (each pair for one env, so Dockerfile + docker-compose.yml for prod, Dockerfile-dev + docker-compose-dev.yml for dev).</p>

<p>But this just seems like a bit of an overkill for me. I would prefer to have it only in two files.</p>

<p>Also one of the problem is that e.g. for development I want to install nodemon globally, but not for poduction.</p>

<p>In perfect solution I imagine running something like that</p>

<pre><code>docker-compose -e ENV=dev build
docker-compose -e ENV=dev up
</code></pre>

<p>Keep in mind, that I still don't fully get docker, so if you caught some of mine misconceptions about docker, you can point them out.</p>
