Connect Local Mongo Express Docker container to MLab mongoDB

  • fennng 
The official docker mongo express document doesn’t mention that you can connect to a remote mongo db. But it can.
Note that you cannot use your Mlab web credential for mongo db login. You have to create a db user after login to the web  portal.
Note that the following command is for windows. You will need to change ^ to \ and also add sudo in the beginning of the command.
 
docker run -it –rm  ^
    –name mongo-express  ^
    -p 8082:8081  ^
    -e ME_CONFIG_MONGODB_PORT=”36577″  ^
    -e ME_CONFIG_MONGODB_SERVER=”ds036577.mlab.com”       ^
    -e ME_CONFIG_MONGODB_AUTH_DATABASE=”mongo” ^
    -e ME_CONFIG_MONGODB_AUTH_USERNAME=”username” ^
    -e ME_CONFIG_MONGODB_AUTH_PASSWORD=”password” ^
    -e ME_CONFIG_MONGODB_ENABLE_ADMIN=”false” ^
    mongo-express 

发表评论

您的电子邮箱地址不会被公开。