Skip to content

Instantly share code, notes, and snippets.

@BrianMwas
Created August 14, 2023 06:17
Show Gist options
  • Save BrianMwas/5ca5a386d199baaeefb294a3250fbeef to your computer and use it in GitHub Desktop.
Save BrianMwas/5ca5a386d199baaeefb294a3250fbeef to your computer and use it in GitHub Desktop.
Complete Docker compose configuration for MongoDB
mongo:
image: mongo
restart: always
container_name: mongo
ports:
- "8081:27017"
volumes:
- ./data/mongo:/data/db
# We have added it here. Ensure its under the /docker-entrypoint-initdb.d
- ./data/mongo/init.js:/docker-entrypoint-initdb.d/init.js:ro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment