安装MongoDB_基于Docker

Docker拉取MongoDB镜像

docker pull mongo

docker-compose.yml文件

version: '3.7'

services:
  mongodb:
    image: mongo
    container_name: mongodb
    ports:
      - "27017:27017"
    volumes:
      - mongodb_data:/data/db
    restart: always

volumes:
  mongodb_data:

启动

docker compose up -d

测试访问

http://<服务器ip>:27017 //It looks like you are trying to access MongoDB over HTTP on the native driver port.

 MongoDB的图形用户界面(GUI)工具安装

https://www.mongodb.com/try/download/compass

使用MongoDB Compass操作MongoDB数据库 

posted @ 2023-10-07 07:02  Ashe|||^_^  阅读(15)  评论(0编辑  收藏  举报