java - Volume map a properties file into a webapp inside docker

Is it possible to volume map a properties file into the class path of a webapp that has been deployed on tomcat inside a docker container? When I try doing that it replaces the contents of the root folder for example:

if the v-map is:

-v < host-folder >/x.properties:< container-path-to-tomcat >/webapps//WEB-INF/classes/x.properties

Then the entire contents of < container-path-to-tomcat >/webapps//WEB-INF/ gets replaced. Any insights? The question is whether replacing deployed artifacts inside a container is even possible?

2 Answers

  1. Mike- Reply

    2019-11-13

    As far as I know, "volumes" in Docker are supposed to be directories and not single files. This is by design. If possible, put your properties file in a separate directory.

  2. Neil- Reply

    2019-11-13

    I think the problem is not related with files but with the workflow of mounting volumes: The appServer will not expand the WAR file because docker already mounted the volume with the same directory name.

    This makes any sense?

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>