-
Notifications
You must be signed in to change notification settings - Fork 649
Basic configuration and persistence #235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
On OSX and Windows you can use a named volume so that docker will persist the data to the VM's hard disk: As for config, you can just pass them in as the command to the image and they will get passed along to $ docker run -d -v mongo-data:/data/db/ mongo --replSet my-replica |
Is there a better way? What if there are a lot of configuration settings? A configuration file is not supported? |
I am not sure how to interpret this warning:
|
The warning is that on OSX/Windows you are not running mongod natively on the host, but in a VM and any folders shared between VM and Host do not support the filesystem access that mongod requires. In short, it will fail to run if you do something like the following: $ docker run -d -v /path/on/osx/:/data/db/ mongo You can add a config file as a flag (it can be put anywhere in the container that the $ docker run -d -v mongo-data:/data/db/ -v /path/to/config/:/etc/mongo/ mongo --config /etc/mongo/mongo.conf (this one could use better docs 😞) |
Question seems sufficiently answered and hasn't had any responses in some months so I'm going to prune. The docs now have a subsection: WARNING (Windows & OS X):
https://github.com/docker-library/docs/tree/master/mongo#where-to-store-data |
So the answer is to use a named volume to persist that data? It seems that text configuration file can be used so you can pass in a configuration via a shared volume. I am not clear what the --config does. |
A named volume is independent of the host filesystem https://docs.mongodb.com/v3.4/reference/program/mongod/#cmdoption-configsvr |
I understand that on OSX and Windows I cannot use -v. I guess I am not clear how the database "persists" when each new container. Is it possible to detail the full path for where the database will be for OSX?
How do I pass configuration information if I cannot use -v? Where is the configuration information maintained/persisted for each new container. The only thing in the documentation is to check the official documentation on the configuration options. Ideas?
The text was updated successfully, but these errors were encountered: