The official docker mongo image supports db creation/initialization:
https://hub.docker.com/_/mongo/
Scroll down to 'MONGO_INITDB_DATABASE'
MONGO_INITDB_DATABASE
This variable allows you to specify the name of a database to be used
for creation scripts in /docker-entrypoint-initdb.d/*.js (see
Initializing a fresh instance below). MongoDB is fundamentally designed
for "create on first use", so if you do not insert data with your
JavaScript files, then no database is created.
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 by mongo using the database specified by the
MONGO_INITDB_DATABASE variable, if it is present, or test otherwise.
You may also switch databases within the .js script.