I created docker-compose.yml to create mongo container:
version: '3'
services :
mongo:
image: mongo:4.2.0
command: mongod --wiredTigerCacheSizeGB 1.5
volumes:
- d:/datadir/mongo:/data/configdb
ports:
- "27018:27017"
I limited wireTigerCach. But after up
when i entered to etc/
directory inside container, i can not find mongo.config file?
root@038321c42774:/# ls -a /etc/
. apt debconf.conf fstab gss issue ldap logrotate.d networks passwd rc2.d resolv.conf shadow- sysctl.conf
.. bash.bashrc debian_version gai.conf host.conf issue.net legal lsb-release nsswitch.conf passwd- rc3.d rmt shells sysctl.d
.pwd.lock bindresvport.blacklist default group hostname kernel libaudit.conf machine-id opt profile rc4.d securetty skel systemd
X11 ca-certificates deluser.conf group- hosts ld.so.cache localtime mke2fs.conf os-release profile.d rc5.d security ssl terminfo
adduser.conf ca-certificates.conf dpkg gshadow init.d ld.so.conf logcheck mongod.conf.orig pam.conf rc0.d rc6.d selinux subgid timezone
alternatives cron.daily environment gshadow- inputrc ld.so.conf.d login.defs mtab pam.d rc1.d rcS.d shadow subuid update-motd.d
root@038321c42774:/#
There is mongod.conf.orig
but where is mongod.conf
and where stored --wiredTigerCacheSizeGB 1.5
?
from the Docs
For a more complicated configuration setup, you can still use the MongoDB configuration file. mongod does not read a configuration file by default, so the --config option with the path to the configuration file needs to be specified. Create a custom configuration file and put it in the container by either creating a custom Dockerfile FROM mongo or mounting it from the host machine to the container. See the MongoDB manual for a full list of configuration file options.
For example, /my/custom/mongod.conf is the path to the custom configuration file. Then start the MongoDB container like the following:
docker run --name some-mongo -v /my/custom:/etc/mongo -d mongo --config /etc/mongo/mongod.conf
or try set flags
like this:
version: '3'
services :
mongo:
image: mongo:4.2.0
volumes:
- d:/datadir/mongo:/data/configdb
ports:
- "27018:27017"
command: --wiredTigerCacheSizeGB 1.5
and the configs
are not stored in any file they will be running as a flags with your command, check docker ps
to see the command for your container
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With