update yml

This commit is contained in:
berkay 2025-04-19 19:23:11 +03:00
parent 1ed5cffe45
commit f29e297afc
1 changed files with 9 additions and 3 deletions

View File

@ -1,9 +1,10 @@
version: '3.8'
version: "3.8"
services:
mongodb:
image: mongo:6.0
container_name: mongodb
hostname: mongodb
restart: always
environment:
- MONGO_INITDB_ROOT_USERNAME=${MONGO_ROOT_USERNAME:-admin}
@ -13,7 +14,7 @@ services:
- mongodb_config:/data/configdb
- ./init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
ports:
- "27017:27017" # Expose MongoDB port to external machines
- "27017:27017" # Expose MongoDB port to external machines
command: ["--auth", "--bind_ip_all", "--replSet", "rs0"]
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/admin --quiet
@ -36,6 +37,7 @@ services:
mongo-express:
image: mongo-express:latest
container_name: mongo-express
hostname: mongo-express
restart: always
environment:
- ME_CONFIG_MONGODB_ADMINUSERNAME=${MONGO_ROOT_USERNAME:-admin}
@ -46,7 +48,7 @@ services:
- ME_CONFIG_MONGODB_ENABLE_ADMIN=true
- ME_CONFIG_SITE_BASEURL=/mongo-express
ports:
- "8081:8081" # Expose Mongo Express web interface to external machines
- "8081:8081" # Expose Mongo Express web interface to external machines
depends_on:
- mongodb
networks:
@ -60,6 +62,10 @@ services:
networks:
mongo_network:
driver: bridge
# Adding explicit configuration to ensure proper DNS resolution
ipam:
config:
- subnet: 172.20.0.0/16
volumes:
mongodb_data: