version: ‘3.5’
networks:
app_net:
external: true
name: $NET_BRIDGE
services:
mongo:
env_file: .env
image: $MONGO_IMAGE
restart: always
privileged: true
container_name: $MONGO_CONTAINER
networks:
- app_net
ports:
-
M
O
N
G
O
H
O
S
T
P
O
R
T
:
MONGO_HOST_PORT:
MONGOHOSTPORT:MONGO_CONTAINER_PORT
volumes:
- /var/koalii/log/mongo/data/db:/data/db:rw
- /var/koalii/log/mongo/data/configdb:/data/configdb:rw
- /etc/localtime:/etc/localtime
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=123456
command:
–wiredTigerCacheSizeGB 1.5
–auth
deploy:
resources:
limits:
cpus: $MONGO_RES_LIMIT_CPU
memory: $MONGO_RES_LIMIT_MEM
logging:
driver: “json-file”
options:
max-size: $MONGO_LOG_MAX_SIZE
max-file: $MONGO_LOG_MAX_FILE
增加账号密码之后,先将共享卷的数据库文件删除