docker-compose管理mongo

mongo-express 可以线上管理mongo 库,下面记录一下docker-compose 配置 mongo以及mongo-express

  version: "3.1"
  services:
    mongo:
      image: mongo
      restart: always
      ports:
        - 27017:27017
      environment:
        - MONGO_INITDB_ROOT_USERNAME=admin
        - MONGO_INITDB_ROOT_PASSWORD=password
    mongo-express:
      image: mongo-express
      restart: always
      ports:
        - 8081:8081
      environment:
        - ME_CONFIG_MONGODB_ADMINUSERNAME=admin
        - ME_CONFIG_MONGODB_ADMINPASSWORD=password
        - ME_CONFIG_MONGODB_SERVER=mongo

docker-compose管理mongo_第1张图片
效果如图所示
执行 docker-compose 的命令

docker-compose -f docker-compose.mongo.yml up -d 

你可能感兴趣的:(docker,linux,docker,容器,运维)