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

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

问题描述

我正在尝试让 docker 安装我的 d 驱动器.一直在努力处理很多堆栈和 git,但它们似乎都不适合我.

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

然后我安装在我的 docker-compose.yml

当文件夹在 C 盘时运行 docker-compose up 有效,但在 D 盘时无效.

我会得到错误package.json not found,意思是D盘没有挂载.

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

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

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

我确实尝试过在环境中设置 MACHINE_STORAGE_PATH,结果没有用,并且搞砸了一切.一定是我做错了什么.

请帮忙.我的新笔记本电脑在 C 盘中只有 128GB,不可能在 C 盘中拥有所有内容.

提前致谢.

解决方案

您可以查看>

您仍然需要在 boot2docker ssh 会话中永久安装它:

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

添加到该文件:

mkdir -p/mnt/srcmount -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

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

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