Skip to content

Instantly share code, notes, and snippets.

@oxlb
Last active March 9, 2020 16:59
Show Gist options
  • Save oxlb/1d0e0d4c56c7993bd269099f7e568d11 to your computer and use it in GitHub Desktop.
Save oxlb/1d0e0d4c56c7993bd269099f7e568d11 to your computer and use it in GitHub Desktop.
Docker-Compose MongoDB Multiple Database Example
version: '3.7'
services:
mongo:
container_name: container-mongodb
image: mongo:latest
restart: always
ports:
- 27017:27017
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: password
MONGO_INITDB_DATABASE: root-db
volumes:
- ./docker-entrypoint-initdb.d/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment