Skip to content

Instantly share code, notes, and snippets.

@Gary-Ascuy
Created May 2, 2017 02:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gary-Ascuy/75af6716831b5c6f34915ed72d7009cb to your computer and use it in GitHub Desktop.
Save Gary-Ascuy/75af6716831b5c6f34915ed72d7009cb to your computer and use it in GitHub Desktop.
# pull mongodb image from Docker hub
docker pull mongo:3.2
# run mongodb container
docker run -d --restart=always \
-v /root/database/:/data/db \
--name mongodb \
mongo:3.2 mongod --smallfiles --nohttpinterface --replSet rs0
# configure replica set, and create oplog user
docker exec -it mongodb mongo
# in the mongo console, remember use better password
use admin
rs.initiate()
db.createUser({user: "oplogger", pwd: "master", roles: [{role: "read", db: "local"}]})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment