I was using Boot2Docker 1.2 (OSX) and wanted to use volume for MongoDB. First nothing was happening because 1.2 has no Guest Additions and volumes don't work. There is a workaround by making a boot2docker.iso from master which has Guest Additions.
But then Mongo didn't like putting data on VirtualBox's shared folders:
[initandlisten] WARNING: This file system is not supported. For further information see:
[initandlisten] http://dochub.mongodb.org/core/unsupported-filesystems
[initandlisten] Please notify MongoDB, Inc. if an unlisted filesystem generated this warning.
MongoDB requires a filesystem that supports fsync() on directories. For example, HGFS and Virtual Box’s shared folders do not support this operation.
So the easiest solutions of all and a proper way for data persistance is Data Volumes
Assuming you have a container that has VOLUME ["/data"]
# Create a data volume
docker run -v /data --name yourData busybox true
# and use
docker run --volumes-from yourData ...
@chuyik
Thanks, that helped a great deal!
However on my machine (OSX Mavericks with
sshfs
version 2.5 andOSXFUSE library version: FUSE 2.7.3 / OSXFUSE 2.7.3
) thesshfs
command timed out with following error:Timeout waiting for prompt
. So what I did was justsshfs docker@localhost:/mnt/sda1/dev <your mac dir path> -p 2022
without the
echo
part and typing thetcuser
password for ssh on the console.