Docker:从Windows主机装载卷 [英] Docker: Mount volume from Windows host

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

问题描述

我在Windows上使用1.12版本的Docker,因为我无法在更新的本机版本中使用Hyper-V功能-因此,我拥有快速入门终端并通过不可见的底层虚拟框与Docker主机进行通信。 / p>

现在,我有一个问题,我需要将本地文件夹安装到容器,该容器通过添加

$ b $在docker-machine中成功运行b

 -volume =`pwd`:/ root / data 

到docker run命令,但是当我从Windows快速入门终端启动相同的命令时却没有(即使 pwd 命令有效



我试图找到该目录的Windows特定设置,并测试了几种格式组合,但没有运气。谁能帮我解决如何正确地为volume参数指定Windows文件夹(例如 C:\Users\alexander.ruehl )?

解决方案

您可以为卷使用相对路径:-volume = ./ mydata:/ root / data



还请确保您已授予对Docker的读/写权限。




I use 1.12 version of Docker on Windows, since I can't use the Hyper-V feature with the newer "native" version - so I have my quickstart terminal and communicate to docker host via the invisible underlying virtual box.

Now I have the problem, that I need to mount a local folder to a container, which worked successfully from within the docker-machine by adding

--volume="`pwd`:/root/data"

to the docker run command, but it does not when I launch the same command from my Windows quickstart terminal (even though pwd command works correctly in the terminal).

I tried to find the Windows specific settings for the directory and tested several combinations of format, but no luck. Can anyone help me out on how to correctly specify a Windows folder (e.g. C:\Users\alexander.ruehl) for the volume parameter?

解决方案

You can use relative path for your volume : --volume="./mydata:/root/data"

Also make sure that you have given the permission for read/write to Docker.

这篇关于Docker:从Windows主机装载卷的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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