Develop Meteor app on OS X via Docker - Dev Environment Setup

Purpose

Basically I'd like to run Meteor app in a ubuntu image of docker on OS X, and use ATOM to edit the source code on OS X. So I share a volume to achieve this purpose.

Problem

The meteor app runs well when it's NOT in the shared volume. However when I put it in the shared volume, it says:

Unexpected mongo exit code 100. Restarting.   
Unexpected mongo exit code 100. Restarting.   
Unexpected mongo exit code 100. Restarting.   
Can't start Mongo server.                     
MongoDB had an unspecified uncaught exception.
This can be caused by MongoDB being unable to write to a local database.
Check that you have permissions to write to .meteor/local. MongoDB does
not support filesystems like NFS that do not allow file locking.

The command I use to run the docker is

docker run -t -i -p 3000:3000 -v ~/Documents/myapp:/home/myapp -d ubuntu

Reason

The reason is that mongodb does not support NFS file type. unfortunately boot2docker uses NFS for the shared volume.

So to run a meteor app successfully in a shared volume, you have to run the mongodb somewhere else. Somewhere like MongoLab. Just export the mongo_url like:

export MONGO_URL=mongodb://localhost:27017/your_db

The virtualbox version is 4.3.30 and boot2docker version is 1.71.

This article summerised from this question on stackoverflow.