I'm doing server side development and my workspace is located in D: because I'm not a fan of storing data on C: but just can't find a way to map d:\Workspace to /home/workspace
I've tried creating a symblink from C:\Users\username to D:\Workspace by:
At first Docker worked fine during that session until I restart Boot2Docker, then start the container I'd get "C:\Users\username\Workspace file exists".
I think this is one Docker's issue but anyways I want to map outside C:\Users.
Share workspace between host and Boot2Docker virtual machine
$ boot2docker down
$ cd "C:\Program Files\Oracle\VirtualBox"
$ VBoxManage sharedfolder add boot2docker-vm --name mydata --hostpath "D:\Workspace"
$ boot2docker up
Mount shared folder
$ boot2docker ssh 'sudo mkdir -p /data'
$ boot2docker ssh 'sudo mount -t vboxsf -o "defaults,uid=33,gid=33,rw" mydata /data'
Create data-only container. Docker best practices always recommends you use data-only containers. You can reuse already available data-only containers:
$ docker run --volume /data:/data --name mydata dylanlindgren/docker-laravel-data
If you want this change to be permanent, you need to add last command inside startup config file /var/lib/boot2docker/bootlocal.sh
sleep 10 && sudo mount -t vboxsf -o "defaults,uid=33,gid=33,rw" mydata /data
docker start mydata
Then, you will have your workspace mounted at /data
You can find more documentation about VirtualBox Guest Additions in Boot2Docker here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With