一佳一

记录像1+1一样简洁的代码

导航

docker MongoDB

Posted on 2022-08-15 12:00  一佳一  阅读(33)  评论(0编辑  收藏  举报
docker pull mongo
docker run --name mongo --restart=always -p 27017:27017  -v /mnt/mongodb/data:/data/mongo/db -v /mnt/mongodb/backup:/data/mongo/backup -v /mnt/mongodb/logs:/data/mongo/log -v /mnt/mongodb/conf:/data/mongo/conf -d mongo
docker exec -it mongo /bin/bash
use admin
db.createUser(
{
user: "admin",
pwd: "admin",
roles: [ { role: "root", db: "admin" } ]
}
);