Last active
October 29, 2021 11:17
-
-
Save ashinga48/4bb2ca46e67d8c10470906cdf19ec7fd to your computer and use it in GitHub Desktop.
MongoDB Local compose snippet
This file contains 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.8" | |
# Read More https://www.bmc.com/blogs/mongodb-docker-container/ | |
services: | |
mongodb: | |
image: mongo | |
container_name: mongodb | |
environment: | |
- MONGO_INITDB_ROOT_USERNAME=root | |
- MONGO_INITDB_ROOT_PASSWORD=pass12345 | |
volumes: | |
- mongodb-data:/data/db | |
networks: | |
- mongodb_network | |
ports: | |
- 27017:27017 | |
healthcheck: | |
test: echo 'db.runCommand("ping").ok' | mongo 10.10.10.60:27017/test --quiet | |
interval: 30s | |
timeout: 10s | |
retries: 3 | |
restart: unless-stopped | |
mongo-express: | |
image: mongo-express | |
container_name: mongo-express | |
environment: | |
- ME_CONFIG_MONGODB_SERVER=mongodb | |
- ME_CONFIG_MONGODB_ENABLE_ADMIN=true | |
- ME_CONFIG_MONGODB_ADMINUSERNAME=root | |
- ME_CONFIG_MONGODB_ADMINPASSWORD=pass12345 | |
- ME_CONFIG_BASICAUTH_USERNAME=admin | |
- ME_CONFIG_BASICAUTH_PASSWORD=admin123 | |
volumes: | |
- mongodb-data | |
depends_on: | |
- mongodb | |
networks: | |
- mongodb_network | |
ports: | |
- 8081:8081 | |
healthcheck: | |
test: wget --quiet --tries=3 --spider http://admin:[email protected]:8081 || exit 1 | |
interval: 30s | |
timeout: 10s | |
retries: 3 | |
restart: unless-stopped | |
volumes: | |
mongodb-data: | |
name: mongodb-data | |
driver: local | |
driver_opts: | |
o: bind | |
type: none | |
device: /Users/kesanam/Desktop/resanec/_mongodb | |
networks: | |
mongodb_network: | |
name: mongodb_network |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment