1.MongoDB之服务启动
1. 编写docker-compose.yaml文件
version: "3"
services:
mongo:
image: mongo:4.2.6
ports:
- 27017:27017
volumes:
- ./data:/data/db:rw
- ./configdb:/data/configdb:rw
environment:
- TZ=Asia/Shanghai
- MONGO_INITDB_ROOT_USERNAME=admin
- MONGO_INITDB_ROOT_PASSWORD=admin
container_name: mongo
2. 服务启动
docker-compose up -d