public:docker:app:mongodb

docker 部署 MongoDB

docker-compose.yml
version: '3'

services:

  mongo:
    image: mongo
    #restart: always
    ports:
      - 27017:27017
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: 123456
    volumes:
      - db_data:/data/db

  mongo-express:
    image: mongo-express
    #restart: always
    ports:
      - 8081:8081
    environment:
      # default login: admin / pass
      ME_CONFIG_MONGODB_ADMINUSERNAME: root
      ME_CONFIG_MONGODB_ADMINPASSWORD: 123456
      ME_CONFIG_MONGODB_URL: mongodb://root:123456@mongo:27017/

volumes:
  db_data:

  • 最后更改: 2023/10/17 01:35
  • 由 Jinkin Liu