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