NoSQL Database
Create a MongoDB instance and a database.
- mongo
- mongo express
- project location: nosql-database
- mongo port:
27017
- mongo express port:
7070
(open it in the web browser)
Run MongoDB and Mongo Express:
cd nosql-database
docker compose up -d
cd ..
Docker Compose
services:
mongo:
image: mongo:5
environment:
MONGO_INITDB_ROOT_PASSWORD: notasecret
MONGO_INITDB_ROOT_USERNAME: root
ports:
- "27017:27017"
restart: on-failure
volumes:
- mongo_data:/data/db
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongo mongo:27017/test --quiet
interval: 10s
timeout: 10s
retries: 5
start_period: 40s
mongo-express:
image: mongo-express:latest
environment:
ME_CONFIG_MONGODB_ADMINPASSWORD: notasecret
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_PORT: "27017"
ME_CONFIG_MONGODB_SERVER: mongo
ME_CONFIG_MONGODB_ENABLE_ADMIN: "true"
ports:
- "7070:8081"
restart: on-failure
depends_on:
mongo:
condition: service_healthy
volumes:
mongo_data:
networks:
default:
external: true
name: kafka-sandbox_network