Skip to content

Instantly share code, notes, and snippets.

@dvliman
Forked from sevastos/docker-mongo-virtualbox.md
Last active August 29, 2015 14:12
Show Gist options
  • Save dvliman/7540963df13e002bc100 to your computer and use it in GitHub Desktop.
Save dvliman/7540963df13e002bc100 to your computer and use it in GitHub Desktop.

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:

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