Docker: Sharing a volume on Windows with Docker Toolbox
See the note for Windows and Mac at https://docs.docker.com/engine/userguide/dockervolumes/#mount-a-host-directory-as-a-data-volume. Particularly:
If you are using Docker Machine on Mac or Windows, your Docker daemon has only limited access to your OS X or Windows filesystem. Docker Machine tries to auto-share your /Users (OS X) or C:\Users (Windows) directory.
Basically, you will need to move your site files to somewhere such as c:\Users\sites
and then mount using something like suggested in documentation:
docker run --name=php5.6_container --rm -v "/c/Users/sites:/var/www/html" -p 80:80 -p 8080:8080 php5.6
- Open "Oracle VM VirtualBox"
- Once "default is selected" click on "configuration"
- Go to "Sheared Folders" Add the desired Folder
Then restart default by typing in your console
docker-machine restart default
Step 1: C:/Program Files/Oracle/VirtualBox/VBoxManage sharedfolder add default -name $shared_folder -hostpath d:/data
To show shared folders:
VBoxManage showvminfo default | less
Step 2(a): mount -t vboxsf -o uid=1000,gid=50 $shared_folder /data
Step 2(b): Adding an automount to boot2docker
While logged into the machine, edit/create (as root) /mnt/sda1/var/lib/boot2docker/bootlocal.sh
by adding below block to the file, sda1 may be different for you...
mkdir -p /datamount -t vboxsf -o uid=1000,gid=50 $shared_folder /data
Then, docker-machine restart default
Step 3: Adding volume when running the container(gogs as example)docker run --name=gogs -rm --net=host -d -v /fuple:/data gogs/gogs