1.Docker compose 文件
version: '3.1'
networks:
mongo:
external: false
services:
mongo-express:
image: mongo-express
restart: always
ports:
- "8081:8081"
environment:
ME_CONFIG_MONGODB_ENABLE_ADMIN: true
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_ADMINPASSWORD: fanqiadmin
#仅当ME_CONFIG_MONGODB_ENABLE_ADMIN为“false”时才需要以下内容
#ME_CONFIG_MONGODB_AUTH_DATABASE: db
#ME_CONFIG_MONGODB_AUTH_USERNAME: root
#ME_CONFIG_MONGODB_AUTH_PASSWORD: fanqiadmin
ME_CONFIG_MONGODB_SERVER: mongo
ME_CONFIG_MONGODB_PORT: 27017
ME_CONFIG_BASICAUTH: true
ME_CONFIG_BASICAUTH_USERNAME: fanqi
ME_CONFIG_BASICAUTH_PASSWORD: fanqiadmin
networks:
- mongo
depends_on:
- mongo
links:
- mongo
mongo:
image: mongo:6.0.6
restart: always
command: --wiredTigerCacheSizeGB 1.5
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: fanqiadmin
networks:
- mongo
ports:
- "27017:27017"
volumes:
- /home/docker/mongodb/config:/etc/mongo
- /home/docker/mongodb/data:/data/db
2.启动
docker compose up -d
标签:ME,fanqiadmin,CONFIG,MongoDb,USERNAME,MONGODB,Docker,安装,mongo
From: https://www.cnblogs.com/fanqisoft/p/17491065.html