1 2 3 4 5 6 7 8 9 10 11 12 13services: mongo: image: mongo:4.4 entrypoint: [ "/usr/bin/mongod", "--bind_ip_all", "--replSet", "rs0" ] # you'll need to run "rs.initiate()" on the node (https://docs.mongodb.com/manual/tutorial/convert-standalone-to-replica-set/) # commands: # $ docker compose exec mongo /bin/bash # $ mongosh # $ rs.initiate() # $ rs.status() ports: - "27017:27017"