docker与共享文件夹d驱动器 [英] docker with shared folder d drive

查看:203
本文介绍了docker与共享文件夹d驱动器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图让码头工具挂载我的d盘。
一直在努力使用很多堆栈和git,而且它们似乎都不适合我。



我已将d盘添加到共享文件夹





然后我挂载在我的docker-compose.yml



文件夹位于C盘中,但不在D盘中时,运行docker-compose即可起作用。





我将收到未找到的package.json错误,这意味着D驱动器未挂载。



我试图检查我的容器,这是我得到的





可以看到源是正确的路径,但它不起作用。



我的设置有问题吗,还是那个码头不支持?
任何解决方法?喜欢把所有东西都移动到D盘?



我曾经尝试过在环境中设置MACHINE_STORAGE_PATH,结果没有工作,搞砸了一切。一定是我做错了



请帮忙。我的新笔记本电脑只有128GB的C盘,不可能有C盘中的一切。



提前感谢。

解决方案

您可以查看



您仍然需要将其永久挂载到boot2docker ssh会话:

  sudo touch /mnt/sda1/var/lib/boot2docker/bootlocal.sh 

添加到该文件:

  mkdir -p / mnt / src 
mount -t vboxsf -o defaults,uid =`id -u docker`,gid =`id -g docker` src / mnt / src


I'm trying to get docker to mount my d drive. Have been struggling with a lot of stack and git, and none of them seem to work for me.

I already added my d drive to the shared folder

then I mount in my docker-compose.yml

running docker-compose up works when the folder is in C drive, but not when in D drive.

I will get the error package.json not found, meaning that the D drive is not mounted.

I tried to inspect my container, and this is what I get

can see that source is the right path, but it doesn't work.

Is it something wrong with my setting, or that docker doesn't support this yet? Any workaround? like move everything to D drive?

I did tried with setting the MACHINE_STORAGE_PATH in environment, turn out didn't work and screw up everything. Must be I did something wrong.

Please help. My new laptop only have 128GB in C drive, is not possible have everything in the C drive.

Thanks in advance.

解决方案

You could check "Docker: Permanently Mount a VirtualBox Shared Folder"

Creating a shared folder in VirtualBox (which you did) is only the first step

You still need to mount it permanently in your boot2docker ssh session:

sudo touch /mnt/sda1/var/lib/boot2docker/bootlocal.sh

Add to that file:

mkdir -p /mnt/src
mount -t vboxsf -o defaults,uid=`id -u docker`,gid=`id -g docker` src /mnt/src

这篇关于docker与共享文件夹d驱动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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