docker-compose 搭建 mongo+mongo-express

version: '3'
services:
  mongo:
    image: mongo
	container_name: mongo
    ports:
      - 27017:27017
    restart: always
    environment:
      MONGO_INITDB_ROOT_USERNAME: mongoadmin
      MONGO_INITDB_ROOT_PASSWORD: mongoadmin
    networks: 
      - network
  mongo-express:
    depends_on:
      - mongo
    image: mongo-express
    container_name: mongo-express
    restart: always
    ports:
      - 8081:8081
    environment:
      ME_CONFIG_OPTIONS_EDITORTHEME: 3024-night
      ME_CONFIG_BASICAUTH_USERNAME: mongoexpress
      ME_CONFIG_BASICAUTH_PASSWORD: mongoexpress
      ME_CONFIG_MONGODB_ADMINUSERNAME: mongoadmin
      ME_CONFIG_MONGODB_ADMINPASSWORD: mongoadmin
    networks: 
      - network
networks:
  network:
    driver: bridge
	ipam:
      driver: default
      config:
        - subnet: 172.16.238.0/16

你可能感兴趣的:(nosql,mongodb)