昨天,今天,明天,每天的每天,你是否都多懂得一点点...

星期二, 九月 11, 2018

[网络技术]Connect Local Mongo Express Docker container to MLab mongoDB

tags: mongodb, mongo express, docker, mlab,

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 

没有评论:

其它博客地址

此博客的同步博客地址: http://fengnz.wordpress.com
这里进入我的MSN SPACE.