Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Deploy MongoDB inside docker.
#!/bin/bash
MONGO_DOCKER_MAX_MEMORY=512M
MONGO_DOCKER_PORT=27017
MONGO_DOCKER_DATA_DIR=/data/db
MONGO_DOCKER_NAME=Mongo-Server
MONGO_LOCAL_PORT=27017
MONGO_LOCAL_DATA_DIR=/docker/mongo/db
docker run \
-d \
-m $MONGO_DOCKER_MAX_MEMORY \
-p $MONGO_LOCAL_PORT:$MONGO_DOCKER_PORT \
-v $MONGO_LOCAL_DATA_DIR:$MONGO_DOCKER_DATA_DIR \
--name "$MONGO_DOCKER_NAME" \
mongo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.