I think this variable is just used to defined the default DB that the JS scripts in /docker-entrypoint-initdb.d/*.js default to if you insert some data or init something (indexes, create timeseries collections, …). It’s like the default use myDB that you can use.
If you don’t create anything in that DB (I don’t see any script in here) then nothing happens and the DB isn’t created. MongoDB will create it if you actually store something in there. Else there is no reason to create an empty vessel.
I’d add that you should try to config this so it’s actually a Replica Set and not just a standalone node which isn’t recommend for a prod env but I don’t know what you are doing ;-). At least having a RS enable a bunch of features (ACID transactions, Change Streams, …).
Personally I use this to hack around on a daily basis:
And then I use alias msh='docker exec -it mongo mongosh --quiet' to connect.
This gives me a single node RS which is enough for me to answer community questions or I can switch to a cluster in Atlas if I need something special (sharding, etc).