Windows + Boot2Docker,如何添加D:\驱动器以从Docker内部进行访问? [英] Windows + Boot2Docker, How to add D:\ drive to be accessible from within docker?

查看:65
本文介绍了Windows + Boot2Docker,如何添加D:\驱动器以从Docker内部进行访问?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,当您打开boot2docker应用程序时,可以在其中打开cd /c/Users,对吗?现在,我希望能够cd /d访问我的D:\目录.

Basically, when you open boot2docker app, inside it you can cd /c/Users, right? Now I want to be able to cd /d to access my D:\ directory.

我不了解VM,所以请像5岁的孩子一样向您解释.

I don't know squat about VM so please explain like you would to a 5-years old.

这与其他方式相关有关如何将Docker映像移动到另一个驱动器的问题.整个想法是释放系统磁盘,因为Docker随时间推移会占用大量空间.

This is in a way related to this other question on how to move docker images to another drive. The whole idea is to free up the system disk since docker stuff takes so much space over time.

推荐答案

答案

在Windows CMD中(仅一次):

Answer

In windows CMD(only once):

VBoxManage sharedfolder add "boot2docker-vm" --name "d-share" --hostpath "D:\"

在Boot2Docker VM终端中(每次引导时):

In the Boot2Docker VM terminal(every time you boot):

mount -t vboxsf -o uid=1000,gid=50 d-share /d

如果您始终要将D:\挂载到/d,则可以将以下条目添加到/etc/fstab(如果可以在boot2docker中编辑fstab,则不能确定):

If you always want to mount your D:\ to /d you can instead add the following entry to /etc/fstab (if you can edit fstab in boot2docker, not sure on this):

d-share   /d   vboxsf   uid=1000,gid=50  0   0

我是如何得出这个答案的,因为它将来可能会改变:

Boot2Docker README.md 在其git repo

How I came about this answer, as it may change in the future:

From the Boot2Docker README.md in their git repo

或者,Boot2Docker包括VirtualBox Guest Additions 内置用于使用VirtualBox文件夹共享的明确目的.

Alternatively, Boot2Docker includes the VirtualBox Guest Additions built in for the express purpose of using VirtualBox folder sharing.

存在的以下第一个共享名(如果有)将是 自动安装在指定的位置:

The first of the following share names that exists (if any) will be automatically mounted at the location specified:

  1. Users/Users
  2. 处的份额
  3. /Users/Users
  4. 处的份额
  5. c/Users/c/Users
  6. 分享 在/c/Users 中共享
  7. /c/Users
  8. c:/Users/c/Users共享
  1. Users share at /Users
  2. /Users share at /Users
  3. c/Users share at /c/Users
  4. /c/Users share at /c/Users
  5. c:/Users share at /c/Users

如果还有其他 需要路径或共享,可以通过在运行时将其挂载 像这样:

If some other path or share is desired, it can be mounted at run time by doing something like:

$ mount -t vboxsf -o uid=1000,gid=50 your-other-share-name /some/mount/location

有您的命令结构.

来自共享文件夹上的VirtualBox来宾添加文档

您可以在命令行中使用VBoxManage创建共享文件夹, 如下:

From the command line, you can create shared folders using VBoxManage, as follows:

VBoxManage sharedfolder add "VM name" --name "sharename" --hostpath "C:\test"

要在引导过程中挂载共享文件夹,请将以下条目添加到 /etc/fstab:

To mount a shared folder during boot, add the following entry to /etc/fstab:

sharename   mountpoint   vboxsf   defaults  0   0

默认的boot2docker vm名称为boot2docker-vm(有想象力),并且您想挂载D目录D:\.让我们称我们的份额为d-share.

The default boot2docker vm name is boot2docker-vm (imaginative) and you want to mount the D directory D:\. Lets call our share d-share.

可以找到,对于几乎相同的问题,答案的解释略有不同.

Can be found here, with a slightly differently explained answer to almost the same question.

这篇关于Windows + Boot2Docker,如何添加D:\驱动器以从Docker内部进行访问?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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