The docker container accesses the host host directory

  docker, question

The project is to usespring-bootBuilt, deployed indockerOne of themUpload fileFunction, need to save the uploaded file inHost host(e.g.:/mnt/files/) in the past few days.

The question now is:

1. InDocker containerIt seems that they cannot be reachedHost host(/mnt/files/)。

2. There are otherdockerThe container for needs to be accessed/mnt/files/Get files for processing.

Can’t this be done?

Thank you!

In other words, the files generated inside the container need to be saved to the host computer, right?

ThroughMount a data volumeTo achieve your needs, create containers for use-vParameter, or in thedockerfileDefined involumes.
For example:

docker run --net=none --privileged=true -d --name etcd -v /data/srcdir:/data/dstdir etcd -name discovery

So if the inside of the container is/data/dstdirThe data generated in the directory will be saved in the host computer/data/srcdirIn the catalog