https://gitlab.com/tozd/docker/mongodb
Available as:
tozd/base
← tozd/dinit
← tozd/mongodb
2.4
: MongoDB 2.42.6
: MongoDB 2.63.2
: MongoDB 3.23.4
: MongoDB 3.43.6
: MongoDB 3.64.0
: MongoDB 4.04.2
: MongoDB 4.24.4
: MongoDB 4.45.0
: MongoDB 5.06.0
: MongoDB 6.0
/var/log/mongod
: Log files whenLOG_TO_STDOUT
is not set to1
./var/lib/mongodb
: Persist this volume to not lose state.
LOG_TO_STDOUT
: If set to1
output logs to stdout (retrievable usingdocker logs
) instead of log volumes.
27017/tcp
: Port on which MongoDB listens.
Image providing MongoDB as a service.
Different Docker tags provide different MongoDB versions.
You should make sure you mount data volume (/var/lib/mongodb
) so that you do not
lose database data when you are recreating a container. If a volume is empty, image
will initialize it at the first startup.
/var/lib/mongodb/mongodb.conf
is used for configuration and you can modify it as needed.
Because it is inside the data volume it is initialized the first time to defaults if the
volume is empty.
If you are extending this image, you can add a script /etc/service/mongod/run.initialization
which will be run at a container startup, after the container is initialized, but before the
MongoDB daemon is run.
When LOG_TO_STDOUT
is set to 1
, Docker image logs output to stdout and stderr. All stdout output is JSON.
From MongoDB 4.4 on also stored logs are JSON.
There is also a read-only GitHub mirror available, if you need to fork the project there.