I am using Docker Toolbox in Windows and am trying to mount a Windows folder in a docker-compose.yml file like this:
nginx:
image: nginx:latest
container
My objective is to Mount
C:\data\www
to boot2docker VM image
From "Manually sharing directory as docker volume mounting point":
You need to:
modify your VirtualBox VM (make sure it is stopped first):
VBoxManage sharedfolder add <machine name/id> --name <mount_name> --hostpath <host_dir> --automount
# in your case
/c/Program\ Files/Oracle/VirtualBox/VBoxManage.exe sharedfolder add default --name www --hostpath 'C:\data\ww' --automount
add an automount to your boot2docker VM:
root
) /mnt/sda1/var/lib/boot2docker/bootlocal.sh
, (sda1
may be different for you)Add
mkdir -p <local_dir>
mount -t vboxsf -o defaults,uid=`id -u docker`,gid=`id -g docker` <mount_name> <local_dir
(you might have to add the umask as in here)