Skip to content

Not able to configure MongoDb with Mongo Express username and password #5736

Discussion options

You must be logged in to vote

Thank you for the reply, your post motivated me to get this darn thing resolved. These are the steps I took to resolve this issue:

  • 'ME_CONFIG_MONGODB_SERVER' is deprecated and now 'ME_CONFIG_MONGODB_URL' is to be used instead.
  • After the @ symbol I had to use host.docker.internal, the image 'name' wouldn't get resolved
  • ME_CONFIG_BASICAUTH_PASSWORD the password value needs NOT be unescaped.

Heres the code which works:

builder.AddMongoDB(name, port)
           .WithImage("mongo")
           .WithImageTag("7.0")
           .WithEnvironment("MONGO_INITDB_ROOT_USERNAME", "root")
           .WithEnvironment("MONGO_INITDB_ROOT_PASSWORD", "Password12!")
           //.WithDataVolume("mongovolume"…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@picBuilderLabs
Comment options

Answer selected by picBuilderLabs
@davidfowl
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants