MongoDB is a free and open-source cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemas
$ docker run --name=mongodb -p 27017:27017 -td phenompeople/mongodb
Above command runs mongodb container with port 27017 mapped to host and connecting to local mongodb.conf.
To make image run even after reboot use extra option --restart=always
$ docker run --restart=always --name=mongodb -p 27017:27017 -td phenompeople/mongodb
Note:
If you remove the container all your data and configurations will be lost, and the next time you run the image the database will be reinitialized.
MongoDB adds a user and group, mongodb, that runs the process and owns the associated files such as logs in /var/log/mongodb and database files in /var/lib/mongodb
You will need to add a user and group, for your new daemon user, as well as chown'ing the files to your new user and group. Linux understand users by IDs not by names, hence create a local user and group mongod with uid 401
To avoid this loss of data, you should mount a volume that will persist even after the container is removed. If you are using default configuration file mount the volume to /var/lib/mongo
MongoDB’s official guide on deploying to production recommends using the XFS file system on Linux, especially when deploying the WiredTiger storage engine.
XFS is a highly scalable, high-performance 64-bit journaling file system developed at SGI in 1993 and ported to Linux in 2002.
Parallelized access via allocation groups ensures multiple threads can perform I/O simultaneously on the same volume.
Extent based allocation reduces fragmentation, metadata size, and improves I/O performance by allowing fewer and larger I/O operations.
Delayed allocation improves data contiguity and performance.
Fragmentation is reduced by combining writes and allocating extents in large chunks, and files written randomly (such as those that are memory mapped) can be allocated contiguously
On your system, use yum to install the xfsprogs and xfsdump packages:
yum install xfsprogs xfsdu
To avoid this loss of data, you should mount a volume that will persist even after the container is removed. If you are using default configuration mount the volume to /var/lib/mongo