Mount a volume in docker-compose conditionally : <p>I have a <code>docker-compose.yml</code> configuration. One of the containers there is a Tomcat server and it has some default <code>.war</code> file deployed in <code>webapps</code> directory.</p>

<p>I want to have the ability to pass (override) the <code>war</code> archive to be deployed by some which resides on the host machine. I think the best would be to have ability somehow switch / override starting <code>docker-compose</code>: as a default, I want to run the webapp (<code>war</code> file) which is inside the container, but I want to have a possibility to mount a directory from my host (for example during development / debugging) if need be.</p>

<p>Currently, I have the following line in my <code>docker-compose.yml</code>, which is commented out if I need the default. </p>

<pre><code>volumes:
# By default, there is the latest version of the application already present in the container
# If you want to provider the container with your own .war file, uncomment the following line
# - ./application/webapps:/usr/local/tomcat/webapps
</code></pre>

<p>Is there a better way how to achieve that?</p>
