I'm actually stuck with the problem of a shared file.
I want to access my host folders so I did something like this in my Jenkinsfile :
sh "sudo docker run -d -it -p 16000:16000 -v /PATH/TO/MY/HOST/FOLDER/:/var/tmp --name botvolume MY_IMAGE"
And in my scala class I'm trying to get all the folders by using :
val folders: Array[File] = new File("/PATH/TO/MY/HOST/FOLDER/") 
  .listFiles
  .filter(_.isDirectory)
But it's doesn't work, it returns a size equal to 0.
I read the docker volumes documentation
Can someone help me?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With