This is a command in the Docker Quickstart Terminal
$ This is a command run inside the docker host or inside a container (linux etc, eg after docker-machine ssh default
or docker run -it ubuntu bash
)
- start docker quick-start terminal
This will create a default vm in VirtualBox
- Add shared folder to that via virtualbox ui with Name dev and targeting the local development folder if the folder is not already inside the users home directory on windows
Note: VirtualBox cannot expose hard-linked folders it seems. So in case e.g c:\Development is actually pointing to e.g E:, you should pick E:\ instead.
Content in the C:\Users folder is automatically shared so if your content is located there its not necessary to do anything more as //c/Users/...:/target would already mount whatever ... path as /target in a container and we could skip to step 3.
docker-machine ssh default
Now we are inside the virtual machine which we will to configure to auto-mount the mounted development folder to the virtual machine
$ cd /var/lib/boot2docker
$ sudo vi ./bootsync.sh
Fill with (or append the mdkir and mount lines to existing content):
#!/bin/sh
mkdir /home/docker/dev
mount.vboxsf dev /home/docker/dev
Note: Also see https://github.com/boot2docker/boot2docker/blob/master/doc/FAQ.md
$ sudo chmod +x ./bootsync.sh
$ exit
docker-machine restart
Verify the mounted folder
docker-machine ssh
$ cd ~/dev
$ ls
Should show the contents of the local development folder target from the virtualbox ui
$ exit
- Mount a host path into a container (any folder inside the docker host itself)
Now that a folder is mounted into the docker host, it can be used as a volume to mount in containers
Verification:
docker run -v '//home/docker/dev/test/docker:/project-test' -it ubuntu bash
This would start a new ubuntu container and mount whatever folder VirtualBox was shared at /home/docker/dev
with the container at /project-test
.
Note: the double / in front of //home is required only to escape the path for msysgit underlying the MINGW64. otherwise it would try to convert the path into a windows path.
after logging into the host run:
$ mkdir <FOLDER-NAME>
$ mount.vboxsf <NAME-OF-SHARED-FOLDER-IN-VBOX-UI> <FOLDER-NAME>
all other examples i found didnt work :)