Mongo Initialization failed

New to Mongo DB, have decided to create a mongo container via docker desktop on mac os. Everything was going swell, have created a network bridge which is going to be used to create a connection between mongo & mongo express. As sson as I run

docker network create m1-mongo-nwork mongo
% docker run -d \                                                                    
-p 27019:27017 \
-e MONGO_INITDB_ROOT_USERNAME=root \
-e MONGO-INITDB_ROOT_PASSWORD=moyosecret \
-e MONGO_INITDB_DATABASE=mymongo \
--name m1-mongodb-10 \
--network m1-mongo-nwork mongo

docker logs 2e135a29c847e7ba25a12a9a4fa761ba188c4a112876919d12dde6ecc3618417

As sson as I enter the above code I get the error :
error: missing ‘MONGO_INITDB_ROOT_USERNAME’ or ‘MONGO_INITDB_ROOT_PASSWORD’

both must be specified for a user to be created

I tried the same setup code in PWD simulator and worked fine. For some reason I’m getting the above error on docker desktop on mac os.

Anyone have any idea or am I going mad?

You wrote a dash character instead of an underscore in the MONGO_INITDB_ROOT_PASSWORD variable name.

ahhhhhhhhhhh :angry:
Unbelievable, I cannot believe I have been tripped up by a dash character

Thanks for pointing that out, everything works as it should

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.