Last active
April 20, 2023 19:57
-
-
Save borisgrigorov/c518ec7ad358117114921f9e13315044 to your computer and use it in GitHub Desktop.
MongoDB docker replica set cluster
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
mongo1: | |
image: mongo | |
container_name: mongo1 | |
ports: | |
- "27017:27017" | |
networks: | |
mongo-net: | |
volumes: | |
- ./data/1:/data/db | |
entrypoint: "mongod --replSet rs0 --bind_ip_all" | |
mongo2: | |
image: mongo | |
container_name: mongo2 | |
networks: | |
mongo-net: | |
volumes: | |
- ./data/2:/data/db | |
entrypoint: "mongod --replSet rs0 --bind_ip_all" | |
depends_on: | |
- mongo1 | |
mongo3: | |
image: mongo | |
container_name: mongo3 | |
networks: | |
mongo-net: | |
volumes: | |
- ./data/3:/data/db | |
entrypoint: "mongod --replSet rs0 --bind_ip_all" | |
depends_on: | |
- mongo1 | |
networks: | |
mongo-net: | |
driver: bridge |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment