docker with shared folder d drive

2019-01-27 01:21发布

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

enter image description here

then I mount in my docker-compose.yml

enter image description here

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

enter image description here

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.

1条回答
甜甜的少女心
2楼-- · 2019-01-27 01:41

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

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

https://s3-us-west-2.amazonaws.com/dvm-public-assets/images/2016/03_05/virtual-box-shared-folders.png

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
查看更多
登录 后发表回答