Add shared folders
docker-machine stop default /c/Program\ Files/Oracle/VirtualBox/VBoxManage.exe sharedfolder add default --name apps --hostpath 'c:\apps' --automount /c/Program\ Files/Oracle/VirtualBox/VBoxManage.exe sharedfolder add default --name mysql-data --hostpath 'C:\mysql\mysql-5.6.21-winx64\data' --automount docker-machine start default
ssh into Dockermachine and mount your folders
sudo mkdir -p /apps sudo mount -t vboxsf -o defaults,uid=`id -u docker`,gid=`id -g docker` apps /apps sudo mkdir -p /opt/data sudo mount -t vboxsf -o defaults,uid=`id -u docker`,gid=`id -g docker` mysql-data /opt/data {\ echo 'mkdir -p /apps'; \ echo 'mount -t vboxsf -o defaults,uid=`id -u docker`,gid=`id -g docker` apps /apps'; \ echo 'mkdir -p /opt/data'; \ echo 'mount -t vboxsf -o defaults,uid=`id -u docker`,gid=`id -g docker` mysql-data /opt/data'; \ } | sudo tee /mnt/sda1/var/lib/boot2docker/bootlocal.sh
Test that mounting from Dockermachine works
docker run -it -v //opt/data:/apps --rm ubuntu ls -ltra //apps
Dockerfile
FROM mysql:5.6
RUN {\
echo 'max_allowed_packet=64M'; \
echo 'innodb_log_file_size=256M'; \
} >> /etc/mysql/my.cnf
Build from Dockerfile
docker build -t msvc/mysql .
Start container from Dockerfile
docker run --name mysql -v //opt/data:/var/lib/mysql -d -p 3306:3306 msvc/mysql
Verify you can connect to mysql
mysql -u root -p -h $(docker-machine ip default)