Here’s what the description of the mongo
image spells out:
Initializing a fresh instance
When a container is started for the first time it will execute files with extensions
.sh
and.js
that are found in/docker-entrypoint-initdb.d
. Files will be executed in alphabetical order..js
files will be executed bymongo
using the database specified by theMONGO_INITDB_DATABASE
variable, if it is present, ortest
otherwise. You may also switch databases within the.js
script.
You may want to try setting MONGO_INITDB_DATABASE
.