Skip to content

Instantly share code, notes, and snippets.

@fenying
Created January 20, 2020 10:32
Show Gist options
  • Save fenying/c78c14c2a7d472a115e633fcd203c7e9 to your computer and use it in GitHub Desktop.
Save fenying/c78c14c2a7d472a115e633fcd203c7e9 to your computer and use it in GitHub Desktop.
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