mongo icon indicating copy to clipboard operation
mongo copied to clipboard

Where are /etc/mongod.conf and the logs in mongo image?

Open eloone opened this issue 11 years ago • 5 comments

When I pull the mongo image https://github.com/docker-library/mongo/blob/1d641659a75cf2f8ce1b517c7fc2a0ebfd033eed/2.6/Dockerfile I don't find the /etc/mongod.conf file, is it normal?

Here is what I found:

docker run mongo find / -name 'mongo*'
/usr/local/bin/mongoperf
/usr/local/bin/mongorestore
/usr/local/bin/mongotop
/usr/local/bin/mongodump
/usr/local/bin/mongoexport
/usr/local/bin/mongooplog
/usr/local/bin/mongostat
/usr/local/bin/mongos
/usr/local/bin/mongofiles
/usr/local/bin/mongoimport
/usr/local/bin/mongod
/usr/local/bin/mongo

Where is the conf file? Also I don't see the image creating the directory for the mongo logs, how is the log directory set?

eloone avatar Jan 28 '15 00:01 eloone

The logs are accessible via docker logs.

Running MongoDB with a configuration file is optional -- it has (sane IMO) defaults for all the flags it supports.

If you'd like to run it with a configuration file, you should be able to put the config file wherever you'd like and run with mongod --config /path/to/where/you/put/mongo.conf.

tianon avatar Jan 28 '15 00:01 tianon

@tianon Cannot run the --config option I created my own image based on mongo and just COPY the config file and nothing works...

It says: /bin/sh: 1: mongod --config /opt/mongodb.conf: not found

vic3lord avatar Apr 27 '15 14:04 vic3lord

@vic3lord, how are you running that? It look like it is looking for the executable file "mongod --config /opt/mongodb.conf", ie CMD ["mongod --config /opt/mongodb.conf"] vs CMD ["mongod", "--config", "/opt/mongodb.conf"]

yosifkit avatar Apr 27 '15 18:04 yosifkit

@yosifkit Thanks it worked but I actually used the command line when the error occurred... I was using: `docker run mymongo 'mongod --config /opt/mongod.conf'

as far as I can see there is an entrypoint.sh script that should handle this.

vic3lord avatar Apr 27 '15 19:04 vic3lord

Ah, you have quotes around the mongod config part, those should not be there as it will interpret it all as one argument the the entrypoint, rather than three as is should be.

yosifkit avatar Apr 27 '15 20:04 yosifkit