简体   繁体   English

如何在Docker中安装网络位置

[英]How to mount network location in docker

I am using docker (1.12.3) in my Ubuntu machine. 我在Ubuntu机器中使用docker(1.12.3)。 I am running a python script which will send its output to a windows network path (\\\\my_win_path\\c). 我正在运行一个python脚本,它将其输出发送到Windows网络路径(\\\\ my_win_path \\ c)。 I am able to execute the python script. 我能够执行python脚本。 Can someone help me with the second part (ie 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? 此网络位置受访问限制(只有少数ID /人可以访问),并且无论如何我都不会在主机上创建任何依赖关系,因为我将创建的映像将被许多其他人使用,并且使用不同的机器来运行图像?

First Mount the Network Path to your Ubuntu machine. 首先将网络路径安装到您的Ubuntu计算机。

Again mount(Mounted Network Path Directory) to the Docker container which can be done by adding -v parameter with docker run command. 再次将(Mounted Network Path Directory)挂载到Docker容器,这可以通过在docker run命令中添加-v参数来完成。 For example if you have mounted the Network drive to /mnt of your Ubuntu machine. 例如,如果您已将网络驱动器安装到Ubuntu计算机的/mnt

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

Now Redirect the output file to /opt inside the container. 现在,将输出文件重定向到容器内的/ opt。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM