Dockerfile and scripts to setup a production ready Mongo container with user authentication and SSL
100K+
Dockerfile and scripts to setup a production ready Mongo container with user authentication and SSL configuration
Example project https://github.com/duluca/lemon-mart-server
mongo docker image as the base.env file at the root of the project and set the MongoDB admin passowrd. Do NOT commit this file.MONGO_INITDB_ROOT_USERNAME=admin_user
MONGO_INITDB_ROOT_PASSWORD=admin_password
MONGODB_APPLICATION_DATABASE=app_db_name
MONGODB_APPLICATION_USER=app_user
MONGODB_APPLICATION_PASS=app_password
npm install to get dependenciesnpm run docker:build to build the Docker imagenpm run docker:debug to build and debug the Docker imageNote: To persist data you must link
/data/dbto a location where the data will persist if this image is stopped. See theymlfile below as an example.
npm run docker:runMount to enable data persistance with this imageFull source code: https://github.com/duluca/lemon-mart-server
docker-compose.yml
version: '3'
services:
web-app:
build: web-app
ports:
- '8080:3000'
server:
build: server
environment:
- MONGO_URI=mongodb://database/minimal-mean
ports:
- '3000:3000'
depends_on:
- database
links:
- database
database:
image: excellalabs/mongo
env_file: .env
ports:
- '27017:27017'
volumes:
- '/my/own/datadir:/data/db'
If you're using AWS ECS as your container host, then your data needs to reside on AWS EFS. Setting this up correctly, so you can easily mount your '/data/db' volume to EFS can be complicated. Check out this step-by-step guide that will help you do just that, including how to create an AWS ECS Cluster from scratch.
SSH capability: https://docs.mongodb.com/manual/tutorial/configure-ssl/Content type
Image
Digest
Size
140.8 MB
Last updated
almost 7 years ago
docker pull excellalabs/mongo