Say .war filename is "app.war" ... you can overwrite it with the env variable as follows:
volumes:
- ./application/webapps/${APPLICATION_ENVasket.war:/usr/local/tomcat/webapps/app.war
Then, when you need to run another war file, just change the value of APPPLICATION_ENV to the one you need to start and restart the container.
I don't think docker-compose has "conditional volumes", but in this way you can change app.war to suit your environment.
In another way, the script after docker-compose up/start will work to overwrite it, and only do this if necessary, for example:
docker-compose exec your-container-name cp /a/volume/path/app.war /usr/local/tomcat/webapps/app.war
Lucas dos santos abreu
source share