Docker Compose 配置文件: 1version: '3.8'2 3services:4 5 mongo:6 image: mongo7 container_name: mongo8 restart: always9 ports:10 -27017:2701711 volumes:12 - /data/mongodb/db:/data/db13 - /data/mongodb/data/log:/var/log/mongodb14 - /data/mongodb/config:/etc/mongo15 environment:16 MONGO_INITDB_ROOT_USERNAME: username17 MONGO_INITDB_ROOT_PASSWORD: password