Why is the path to save files for the project deployed by docker in devicemapper/mnt/

  docker, question

Problem description

For javaWeb projects deployed by docker, the business requires to generate a csv file and save it under local /home.
But the truth has been preserved

/docker/devicemapper/mnt/026394b35f254aed40b3516900c95730f9c5da8804613ff334793de840ac76cc/homeUnder the catalog.

Related codes

final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
 final String filePath = TypeConstants.DMZ_FILE_PATH + "/" + dateFormat.format(date) + ".csv";
 Info ("server production file path filePath:"+filePath");
 File file;
 try {
 Info ("server generation file starts.  .  .  .  .  .  。"  );
 file = new File(filePath);
 if (!  file.exists()) {
 Info ("judgment file does not exist.  .  .  .  .  .  。"  );
 file.getParentFile().mkdirs();
 LOGGER.info ("file absolute path:"+file.getparentfile (). getabsolute path ());
 
 file.createNewFile();
 }else{
 Info ("judge file exists.  .  .  .  .  .  。"  );
 file.delete();
 file.createNewFile();
 }
 final BufferedWriter out =new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file.getAbsoluteFile()),"UTF-8"));
 for (int i = 0;   i < resultdata.size();  i++)
 {
 Info ("write file contents");
 final ArrayList<String> onerow=resultdata.get(i);
 LOGGER.info ("write file line:" +resultdata.get(i));
 for (int j = 0;   j < onerow.size();  j++)
 {
 LOGGER.info ("write file content:" +onerow.get(j));
 out.write(onerow.get(j));
 out.write(",");
 }
 out.newLine();
 }
 out.flush();
 out.close();

What is your expected result? What is the actual error message?

How can I save it to/homeDocuments instead of #docker/devicemapper/mnt/026394b35f254aed40b3516900c95730f9c5da8804613ff334793de840ac76cc/homeBelow

The file system in the docker container is isolated from the file system of the host, and the processes in the container cannot directly access the file system of the host.
You need to use it when starting the container.-vOption to mount a directory of the host into the container.

Docker run -v /home:/home mirror name other parameters

In this way, when the container runs, the /home directory of the host will be mounted under /home in the container, and the process accessing /home in the container is equivalent to accessing the /home directory of the host.