在Docker上运行MongoDB

在Docker上运行MongoDB

严少安 Lv.6

Run MongoDB on Docker

1
2
3
4
5
6
# run
docker run --name mongo34 -p 27017:27017 -d mongo:3.4
# connect
docker exec -it mongo34 mongo admin
# create user
db.createUser({ user: 'shawnyan', pwd: 'password', roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] });

Reference

  • Title: 在Docker上运行MongoDB
  • Author: 严少安
  • Created at: 2018-02-20 20:10:01
  • Updated at: 2018-02-20 20:10:01
  • Link: https://shawnyan.cn/2018/docker/docker-with-mongodb/
  • License: This work is licensed under CC BY-NC-SA 4.0.
 Comments