Hi, so I’m relatively new to mongoDB and docker and I’m trying to spin up a mongoDB container to use for testing/development. However like the title says I’ve noticed that when passing in environment variables MONGO_INITDB_ROOT_USERNAME , MONGO_INITDB_ROOT_PASSWORD to automatically set admin name and password the container doesn’t create the default databases admin, config, local. Im assuming this is an issue as (again making an assumption here) admin database is supposed to store the administrator/root user and their password no? Should I just create these databases manually?
Also I can’t use version 5 because of CPU issues. I saw an issue on github where certain older cpu’s don’t/wont allow the container to initialize and this seems to be a issue with me as well as I’m running this on an older machine and I spent way too much time trying to get 5 running before giving up and using 4.4 with no issues what so ever.
Ok so from my understanding the --rm removed the container as soon as it’s exited correct? When I try to run your first paragraph i just get a bunch of log output and then I cant input anything I have to cntrl+C to get out and it just shuts down on me.
can you please try :
docker run -d --name test \
-e MONGO_INITDB_ROOT_USERNAME=root \
-e MONGO_INITDB_ROOT_PASSWORD=solarwinds1234 \
-v mdb-data:/data/db \
-p 127.0.0.1:27017:27017 \
docker exec -it test bash
and let me know if it initializes anything?
I’m doing it step by step but eventually I also want to add -v /mnt/externalHD/mongoDB:/data/dd so that i can access teh db from outside as well.