Can anyone explain why the Spring Boot Boot Guide recommends adding the volume /tmpas follows:
VOLUME /tmp
This explains:
We added VOLUME pointing to "/ tmp" because this is where the Spring Boot application creates working directories for Tomcat by default. The effect is to create a temporary file on your host in "/ var / lib / docker" and link it to the container in "/ tmp".
however, I do not quite understand why you want / should do this.
If the java application creates any files in the / tmp directory of the container, I don’t see the need to configure it as a volume, because, as I understand it, this will cause the files to bypass the merge file system and will be recorded permanently in the Docker host for /var/lib/docker. Could this also lead to the fact that “temporary” files created in the container are not deleted automatically when the container is stopped?
My spring boot application (which creates temporary files) seems to work fine without this VOLUME, but I'm wondering if there are any negative consequences if you don't follow this advice.
Thank you
David source
share