so I am having trouble creating mongo containers, then creating a db and a user for that db. I have a batch file that does Docker Run, then it waits a period of time, then it uses docker -u <uname> -p <pwrd> < ./setup.js.
Then in the js file i have
use <dbname>
db.createUser({user: '<dbuname>', pwd: '<pwrd>', roles: [{role: 'dbOwner', db: '<dbname>'}]})
But it seems it comes up with and error that this user is already created. But when I go into the docker shell and into mongo, i switch to that db, and do show users, db.getUsers(); etc with nothing returned.
When i move the code out of the js file and into a -eval variable, the cli shows a user created, but i still can't see after when going into the container.
Any ideas what is going on here?