Skip to content

Instantly share code, notes, and snippets.

@dveni
dveni / local-mongo-replicaset-with-docker
Last active December 28, 2020 13:53 — forked from simon-contreras-deel/local-mongo-replicaset-with-docker
Local mongo replicaset with docker for BDFI replication assignment #docker #mongo
# useful link: https://www.sohamkamani.com/blog/2016/06/30/docker-mongo-replica-set/
# pull the official mongo docker container
docker pull mongo
# create network
docker network create my-mongo-cluster
# create mongos
docker run -d --net my-mongo-cluster -p 27001:27001 --name mongo1 mongo mongod --replSet my-mongo-set --port 27001
docker run -d --net my-mongo-cluster -p 27002:27002 --name mongo2 mongo mongod --replSet my-mongo-set --port 27002