Skip to content

Instantly share code, notes, and snippets.

@spdeepak
Last active August 3, 2018 14:56
Show Gist options
  • Save spdeepak/b0be494794abdcaf761cee88494303db to your computer and use it in GitHub Desktop.
Save spdeepak/b0be494794abdcaf761cee88494303db to your computer and use it in GitHub Desktop.
#1. Start MongoDB container
docker run -p 27017:27017 --name macmongo -e MONGO_INITDB_ROOT_PASSWORD=root -e MONGO_INITDB_ROOT_USERNAME=root -e MONGO_INITDB_DATABASE=testdatabase -d mongo:latest
#2. Open MongoDB shell
docker exec -it macmongo mongo --authenticationDatabase admin -u root -p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment