之前有看一个个人开发者的MERN Stack技术栈,而我习惯在我的MacBook不装数据库,理由是卸载起来比较麻烦,所以类似MySQL、MongoDB都是使用Docker-Compose进行安装
MongoDB的配置如下
version: '3.8'
services:
mongodb:
image: mongo:latest
restart: always
container_name: mongodb
volumes:
- $PWD/db:/data/db
- $PWD/log:/var/log/mongodb
ports:
- 27017:27017
# environment:
# MONGO_INITDB_ROOT_USERNAME: admin
# MONGO_INITDB_ROOT_PASSWORD: admin