从Docker容器访问Windows计算机的文件 [英] Access file of windows machine from docker container

查看:762
本文介绍了从Docker容器访问Windows计算机的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Windows 10操作系统中安装了适用于Windows的Docker桌面. 我正在docker容器中运行一个python脚本,该脚本从磁盘读取文件并在文件末尾添加一些文本.现在的要求是从Windows 10读取文件并对其执行相同的操作.

I have installed Docker Desktop for Windows in Windows 10 operating system. I am running a python script inside docker container which reads file from disk and add few text at the end of files. Now the requirement is to read files from Windows 10 and perform the same operation on it.

泊坞窗中是否可以从运行Docker的操作系统中读取文件?

Is it possible in docker to read files from OS on top of which Docker is running?

推荐答案

当然,您可以使用音量.

例如,您可以运行以下命令:

For example, you can run the following command:

docker run -v path/to/your/file/on/host:path/to/the/file/on/container your_image

这篇关于从Docker容器访问Windows计算机的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆