services: mongo: image: mongo container_name: mongo restart: always environment: MONGO_INITDB_ROOT_USERNAME: ${MONGO_INITDB_ROOT_USERNAME} MONGO_INITDB_ROOT_PASSWORD: ${MONGO_INITDB_ROOT_PASSWORD} volumes: - ./mongodb/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro - ./mongodb/mongod.conf:/etc/mongod.conf:ro - mongodata:/data/db command: ["mongod", "--config", "/etc/mongod.conf"] ports: - "27017:27017" mongo-express: image: mongo-express container_name: mongo-express restart: always environment: ME_CONFIG_MONGODB_ADMINUSERNAME: ${MONGO_INITDB_ROOT_USERNAME} ME_CONFIG_MONGODB_ADMINPASSWORD: ${MONGO_INITDB_ROOT_PASSWORD} ME_CONFIG_MONGODB_URL: mongodb://${MONGO_INITDB_ROOT_USERNAME}:${MONGO_INITDB_ROOT_PASSWORD}@mongo:27017/ ME_CONFIG_BASICAUTH: "true" depends_on: - mongo ports: - "8082:8081" volumes: mongodata: