Git-Repository to build Docker containerimage for MongoDB.
If you find this image helpfull, so you can see here how you can help:
- Send a pull request with your features and bug fixes
- Help users resolve their issues.
Before reporting your issue please try updating Docker to the latest version and check if it resolves the issue. Refer to the Docker installation guide for instructions.
If that recommendations do not help then report your issue along with the following information:
- Output of the
docker version
anddocker info
commands - The
docker run
command ordocker-compose.yml
used to start the image. Mask out the sensitive bits.
Automated builds of the image are available on Dockerhub
docker pull mongocamp/mongodb:7.0.15
Alternatively you can build the image yourself.
docker build . --tag 'mongocamp/mongodb:dev';
Start MongoDB using:
docker run --publish 27017:27017 mongocamp/mongodb:7.0.15
Alternatively, you can use the sample docker-compose.yml file to start the container using Docker Compose
For MongoDB to persist the state of the container across shutdown and startup, you should mount a volume at the data directory. The container image use by default /var/lib/mongodb
.
You can cange the data directory with the Docker Environment Variable MONGO_DATA_DIR
.
The Quickstart and docker-compose.yml Sample command or the Quickstart bash command already mounts a volume for persistence.
Variable | Default Value | Informations |
---|---|---|
MONGO_DATA_DIR | /var/lib/mongodb | |
MONGO_ROOT_USERNAME | root | |
MONGO_PORT | 27017 | Specifies the TCP port on which the MongoDB |
MONGO_ROOT_PWD | NONE | If the param not equal NONE or "" the MongoDB authorization will enabled. The password of the MONGO_ROOT_USERNAME will be reseted on every container start. |
MONGO_LOG | STDOUT | Enable Loging to LogPath. Default is the stdout of the docker container, but you can also use something like /var/log/mongodb/mongo.log |
MONGO_LOG |
||
MONGO_STORAGEENGINE | wiredTiger | Value for the storageEngine parameter |
MONGO_WIREDTIGER_CACHE_SIZE_GB | NONE | Value for the wiredTigerCacheSizeGB parameter |
MONGO_MAX_CONNECTIONS | NONE | Value for the maxConns parameter if not equal NONE |
MONGO_REPLICA_SET_NAME | NONE | If the param not equal NONE or "" set name for replSet replication options |
MONGO_BINDING | --bind_ip_all | ip binding ip binding options |
MONGO_EXTRA_ARGS | You can use every mongod commandline option |
|
MONGO_REPLICA_KEY | generate random | Used for communication between replica sets Replica Set to Keyfile Authentication |