title: Docker compose: Multiple isolated environments on a single host with overridable volumes and ports
body: <p>We have a requirement of creating multiple isolated envs of our app in a single host, using a <strong>single compose file</strong>.</p>
  
  <p>I realized that by <a href="https://docs.docker.com/compose/overview/#multiple-isolated-environments-on-a-single-host" rel="nofollow">specifying the project name</a> using <code>-p</code> option we can create multiple isolated envs using docker compose in a single host.</p>
  
  <p>However is it possible to override the  <code>ports:</code> and <code>volumes:</code> in the compose file for different environment, without having 2 seperate docker compose files?</p>
  
  <p>For instance, I would like to override the following properties, preferably through command-line args. </p>
  
  <p>For <em>dev</em> environment</p>
  
  <pre><code>ports:
   8081:8080
  
  volumes:
   /etc/myapp/dev/properties/:/etc/myapp/properties 
  </code></pre>
  
  <p>For <em>QA</em> environment</p>
  
  <pre><code>ports:
   8082:8080
  
  volumes:
   /etc/myapp/qa/properties/:/etc/myapp/properties 
  </code></pre>