How to access to a folder host via a docker container? How to access to a folder host via a docker container? jenkins jenkins

How to access to a folder host via a docker container?


Inside the container the volume path is /var/tmp

Then your code should be :

val folders: Array[File] = new File("/var/tmp/")   .listFiles  .filter(_.isDirectory)

You can find the detail on the Docker volume bind syntax on the link you provided:

-v or --volume: Consists of three fields, separated by colon characters (:). The fields must be in the correct order, and the meaning of each field is not immediately obvious.

  • In the case of bind mounts, the first field is the path to the file or directory on the host machine.
  • The second field is the path where the file or directory will be mounted in the container.
  • The third field is optional, and is a comma-separated list of options