docker安装mongo(密码访问方式)附容器连接示例

docker pull mongo:latest
docker run -itd --name mongo -p 27017:27017 mongo --auth

docker exec -it mongo mongo admin

db.createUser({ user:'admin',pwd:'123456',roles:[ { role:'userAdminAnyDatabase', db: 'admin'},"readWriteAnyDatabase"]});
db.auth('admin', '123456');
exit

以wekan容器的启动示例:

docker run -d --restart=always --name wekan --link "mongo:db" -e "MONGO_URL=mongodb://admin:123456@db" -e "ROOT_URL=http://web.url.com:8282"  -p 8080:80 wekanteam/wekan
上一篇:利用Docker Compose整合springboot + mongo + redis


下一篇:scrapy mongo pipeline