快速启动mongodb和mongo-express

文档说明:只记录关键地方;
试验环境: linux debian 11

mongodb和mongo-webUI

version: "3"
services:
    mongodb-server:
        image: mongo:latest
        container_name: mongodb
        environment:
            MONGO_INITDB_ROOT_USERNAME: root
            MONGO_INITDB_ROOT_PASSWORD: example
        ports:
            - "27017:27017"
        volumes:
            - ./mongodb-data:/data/db
    mongo-express:
        image: mongo-express:latest
        container_name: mongo-express
        depends_on:
            - mongodb-server
        ports:
            - "8081:8081"
        environment:
            ME_CONFIG_MONGODB_SERVER: mongodb-server  # 服务名称
            ME_CONFIG_MONGODB_ADMINUSERNAME: root
            ME_CONFIG_MONGODB_ADMINPASSWORD: example
            ME_CONFIG_BASICAUTH_USERNAME: "admin"
            ME_CONFIG_BASICAUTH_PASSWORD: "admin"

启动、关闭、查看日志

# 启动
docker-compose -f docker-compose.yaml up -d 
# 关闭
docker-compose -f docker-compose.yaml down --remove-orphans
# 查看日志
docker-compose -f docker-compose.yaml logs -f 

参考文档

  1. docker mongo
  2. dockerhub mongo tags
  3. github mongo docker docs
  4. 自建拉取registry.k8s.io、k8s.gcr.io、gcr.io、quay.io、ghcr.io 容器镜像的服务
posted @ 2022-10-25 19:51  jingjingxyk  阅读(142)  评论(0编辑  收藏  举报