0

I am using docker (1.12.3) in my Ubuntu machine. I am running a python script which will send its output to a windows network path (\\my_win_path\c). I am able to execute the python script. Can someone help me with the second part (i.e. sending the output(its a text file) to network location).

This network location is access restricted (only few ids/people have access) and is there anyway that I do not create any dependency on the host machine, as the image I will be creating will be used by lot of other people and they will be using different machines to run the image?

Raji
  • 857
  • 6
  • 18
  • 37

1 Answers1

0

First Mount the Network Path to your Ubuntu machine.

Again mount(Mounted Network Path Directory) to the Docker container which can be done by adding -v parameter with docker run command. For example if you have mounted the Network drive to /mnt of your Ubuntu machine.

docker run --privileged -v /mnt:/opt <rest/of/the/parameters>

Now Redirect the output file to /opt inside the container.

shahin
  • 3,515
  • 1
  • 17
  • 17
  • refer this link to learn about mounting of Windows Network drive :[mounting-windows-network-shares-in-linux](https://martin.hoppenheit.info/blog/2014/mounting-windows-network-shares-in-linux/) – shahin Apr 01 '17 at 20:01
  • Please do NOT use `--privileged` if not needed; running with that option disables all security that containers provide, and allow processes inside the container to break out, and take control of the host – thaJeztah Apr 01 '17 at 22:39
  • Thanks a lot Shahin and Jeztah. By doing the one you suggested, I can get the mounted location in container but it is creating a dependency on to the host machine. If I create this image and push and if some other person pulls the images and runs it then it will not run on his/her machine as they may not have it mounted in in their machine. I wanted to know if there is any way this dependency goes away. – Raji Apr 02 '17 at 09:21
  • I have posted one more question in similar lines (regarding mount and write access): http://stackoverflow.com/questions/43170818/shell-script-to-mount-windows-network-location-in-linux-machine – Raji Apr 02 '17 at 16:49