Skip to content

Instantly share code, notes, and snippets.

@makhmudovrt
makhmudovrt / compose.yaml
Created October 25, 2023 18:33
Mongo 7 with a replica set with only one node in docker compose
version: "3.7"
services:
# simple
mongo:
image: mongo
command: mongod --replSet rs0 --bind_ip_all
healthcheck:
test: |
mongosh --eval "try { rs.status().ok } catch (e) { rs.initiate({ _id: 'rs0', members: [{ _id: 0, host: 'localhost:27017' }] }).ok }"