A mongodb container is successfully created based on below docker-compose configuration:
mongodb:
build: ./mongodb
container_name: iboorse_mongo
restart: unless-stopped
command: mongod --auth --config /etc/mongod.conf
environment:
- MONGO_INITDB_ROOT_USERNAME
- MONGO_INITDB_ROOT_PASSWORD
- MONGO_INITDB_USERNAME
- MONGO_INITDB_PASSWORD
- MONGO_INITDB_DATABASE
volumes:
- ./mongodb/001_init-mongo.sh:/docker-entrypoint-initdb.d/001_init-mongo.sh
- ./mongodb/mongod.conf:/etc/mongod.conf
- mongo-data:/data/db
ports:
- ${MONGO_EXPOSED_PORT}:27017
after some time, some data was stored in the DB but got the below error. the container is being terminated immediately after it starts. (so I don't have enough time to connect to the container and investigate the problem).
error: unexpected "js-yaml.js" output while parsing config
mongodb.conf:
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /data/db
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# where to write logging data.
# systemLog:
# destination: file
# logAppend: true
# path: /data/mongod.log
# network interfaces
net:
port: 27017
bindIpAll: true
# bindIp: 127.0.0.1
# how the process runs
processManagement:
timeZoneInfo: /usr/share/zoneinfo
security:
authorization: 'enabled'
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options:
#auditLog:
#snmp:
any help would be appreciated!