Created
March 1, 2022 20:16
-
-
Save harsh4870/4763e53ebe6fa2b0f40633c373addf0d to your computer and use it in GitHub Desktop.
MongoDb docker compose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.7' | |
services: | |
mongodb_container: | |
image: mongo:latest | |
environment: | |
- MONGO_INITDB_ROOT_USERNAME=root | |
- MONGO_INITDB_ROOT_PASSWORD=password | |
- MONGO_INITDB_DATABASE=test | |
ports: | |
- 27017:27017 | |
volumes: | |
- mongodb_data_container:/data/db | |
#- ./init-mongo.js:/docker-entrypoint-initdb.d/mongo-init.js:ro | |
volumes: | |
mongodb_data_container: | |
#Give database access to user | |
#db.createUser( { user: "root", pwd: "password", roles: [ { role: "readWrite", db: "test" }, { role: "read", db: "test" } ] } ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment