Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@sevastos
Last active December 3, 2022 10:11
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save sevastos/2fa4c86f01541351efe8 to your computer and use it in GitHub Desktop.
Save sevastos/2fa4c86f01541351efe8 to your computer and use it in GitHub Desktop.
Boot2Docker (VirtualBox) MongoDB volume filesystem issue

Journey

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.

Solution

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 ...

:shipit:

@asemt
Copy link

asemt commented Feb 4, 2015

@chuyik
Thanks, that helped a great deal!
However on my machine (OSX Mavericks with sshfs version 2.5 and OSXFUSE library version: FUSE 2.7.3 / OSXFUSE 2.7.3) the sshfs command timed out with following error: Timeout waiting for prompt. So what I did was just
sshfs docker@localhost:/mnt/sda1/dev <your mac dir path> -p 2022
without the echo part and typing the tcuser password for ssh on the console.

@learntoswim
Copy link

@chuyik - Are you still using this method for data storage and Mongo, or did you find another solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment