docker-compose.yaml
# Use root/example as user/password credentials version: "3.1" services: mongo-primary: image: mongo:4.4.0 container_name: mongo-primary ports: - 30000:27017 networks: - mongo-compose-network volumes: - mongo_db_primary:/data/db - mongo_configdb_primary:/data/configdb restart: unless-stopped depends_on: - mongo-secondary - mongo-arbiter command: "--bind_ip_all --replSet rs0" mongo-secondary: image: mongo:4.4.0 container_name: mongo-secondary ports: - 30001:27017 networks: - mongo-compose-network volumes: - mongo_db_secondary:/data/db - mongo_configdb_secondary:/data/configdb restart: unless-stopped command: "--bind_ip_all --replSet rs0" mongo-arbiter: image: mongo:4.4.0 container_name: mongo-arbiter ports: - 30002:27017 networks: - mongo-compose-network volumes: - mongo_db_arbiter:/data/db - mongo_configdb_arbiter:/data/configdb restart: unless-stopped command: "--bind_ip_all --replSet rs0" mongo-express: image: mongo-express ports: - 8081:8081 environment: ME_CONFIG_MONGODB_SERVER: mongo-primary,mongo-secondary,mongo-arbiter ME_CONFIG_MONGODB_PORT: 27017 ME_CONFIG_MONGODB_ENABLE_ADMIN: true ME_CONFIG_MONGODB_ADMINUSERNAME: root ME_CONFIG_MONGODB_ADMINPASSWORD: rootpassword ME_CONFIG_MONGODB_AUTH_DATABASE: admin ME_CONFIG_MONGODB_AUTH_USERNAME: root ME_CONFIG_MONGODB_AUTH_PASSWORD: rootpassword ME_CONFIG_BASICAUTH_USERNAME: admin ME_CONFIG_BASICAUTH_PASSWORD: q depends_on: - mongo-primary networks: - mongo-compose-network networks: mongo-compose-network: driver: bridge volumes: mongo_db_primary: mongo_configdb_primary: mongo_db_secondary: mongo_configdb_secondary: mongo_db_arbiter: mongo_configdb_arbiter:
Leave a Comment