# Use root/example as user/password credentials
version: '3.8'
services:
# mongodb server
mongo:
image: mongo
restart: always
environment:
# 管理员用户
MONGO_INITDB_ROOT_USERNAME: root
# 管理员密码
MONGO_INITDB_ROOT_PASSWORD: example
# 浏览器页面管理 mongodb,相当于一个 mongodb 的客户端管理程序
mongo-express:
# 镜像名称
image: mongo-express
# 容器异常关闭后,容器自动重启
restart: always
# 访问的端口;http://ip:8081
ports:
- 8081:8081
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_ADMINPASSWORD: example