Skip to content

Instantly share code, notes, and snippets.

@bartosz-maciaszek
Created June 12, 2026 10:05
Show Gist options
  • Select an option

  • Save bartosz-maciaszek/518f24fb5c2c0de11a165489f37109c3 to your computer and use it in GitHub Desktop.

Select an option

Save bartosz-maciaszek/518f24fb5c2c0de11a165489f37109c3 to your computer and use it in GitHub Desktop.
Mongo local replica set
services:
mongo:
image: mongo:7.0
container_name: mongo_replica
hostname: mongo_replica
command: ["--replSet", "rs0", "--bind_ip_all", "--port", "27017"]
volumes:
- dbdata:/data/db
ports:
- "27017:27017"
restart: always
healthcheck:
test: echo "try { rs.status() } catch (err) { quit(1) }" | mongosh --port 27017 --quiet
interval: 10s
timeout: 5s
retries: 5
volumes:
dbdata:
external: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment