docker安装mongodb
一、拉取
docker pull mongo
二、启动
docker run -d --name mongo -p 27017:27017 -v /home/docker/mongo/db:/data/db -e MONGO_INITDB_ROOT_USERNAME=admin -e MONGO_INITDB_ROOT_PASSWORD=admin --restart=always mongo
三、配置
docker exec -it idxxx bash mongo admin use admin db.auth("admin","admin")
#给easy-mock库创建用户 use easy-mock db.createUser({user: "root", pwd: "root", roles: [{ role: "dbOwner", db: "easy-mock" }]})