title: How to manage temporary files in docker?
body: <p>I'm running a Java application that reads some data in a given format and writes a CSV file in the temp directory. After this file is fully written, the data is bulk loaded in the database. When the load is done, the file is immediately deleted. This file should not be shared.</p>
  
  <p>Now, I want to run a jar of this application in a docker container.</p>
  
  <p>From the docs, I've read:</p>
  
  <blockquote>
    <p>Writing into a container’s writable layer requires a storage driver to manage the filesystem. The storage driver provides a union filesystem, using the Linux kernel. This extra abstraction reduces performance as compared to using data volumes, which write directly to the host filesystem.</p>
  </blockquote>
  
  <p>From what I understand, it would be better if I create a volume to map the host /tmp folder so I can have better performance for I/O operations. On the other hand, it seems that volumes are used for persistence reasons, although my use case consists of temporary files. </p>
  
  <p>Are volumes recomended when managing temporary files? If not, is there a efficient approach to deal with temporary files in docker? </p>