Skip to content

Instantly share code, notes, and snippets.

@mckernanin
Last active April 5, 2019 02:42
Show Gist options
  • Save mckernanin/fed1cd204288a2ed1132e94e9f7a19b6 to your computer and use it in GitHub Desktop.
Save mckernanin/fed1cd204288a2ed1132e94e9f7a19b6 to your computer and use it in GitHub Desktop.
Example mongodb docker setup
version: "2"
services:
mongo:
image: mckernanin/mongo-auth:4.0.8
environment:
AUTH: "yes"
MONGODB_ADMIN_USER: admin
MONGODB_ADMIN_PASS: '**********' # set your admin password here
MONGODB_APPLICATION_DATABASE: appname # give the db a name
MONGODB_APPLICATION_USER: application
MONGODB_APPLICATION_PASS: '**********' # set your application password here
ports:
- 27017:27017
volumes:
- ~/.mongo:/data/db # this persists your mongo data to disk outside of docker
# mongo-backup: # automated backups to s3
# image: lgatica/mongodump-s3
# environment:
# MONGO_URI: mongodb://application:**********@mongodb/appname # connection string based on above config
# AWS_ACCESS_KEY_ID: '**********' # aws access key
# AWS_SECRET_ACCESS_KEY: '**********' # aws secret key
# AWS_DEFAULT_REGION: us-east-2 # aws region
# S3_BUCKET: '**********' # aws bucket name
# BACKUP_CRON_SCHEDULE: 0 2 * * *
# S3_PATH: '**********' # aws bucket path
# links:
# - mongo:mongodb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment