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" } ] } );