“Docker mongo”的版本间的差异
跳到导航
跳到搜索
小 (导入1个版本) |
|||
第1行: | 第1行: | ||
+ | |||
+ | <pre> | ||
+ | |||
+ | cat docker-compose.yml | ||
+ | version: "3" | ||
+ | services: | ||
+ | mongodb: | ||
+ | image: mongo:4.2 | ||
+ | container_name: mongodb4.2 | ||
+ | ports: | ||
+ | - "27017-27019:27017-27019" | ||
+ | volumes: | ||
+ | # - /Users/Pie/docker-lnmp/conf/mongodb/:/etc/mongo/:rw | ||
+ | - /data/db_data/mongodb/:/data/db/:rw | ||
+ | - /data/log/mongodb/:/var/log/mongodb/:rw | ||
+ | environment: | ||
+ | #设置后台登录用户和密码,没设置默认为:guest/guest | ||
+ | MONGO_INITDB_ROOT_USERNAME: "root" | ||
+ | MONGO_INITDB_ROOT_PASSWORD: example36 | ||
+ | TZ: "Asia/Shanghai" | ||
+ | restart: always | ||
+ | networks: | ||
+ | - default | ||
+ | |||
+ | |||
+ | </pre> | ||
+ | |||
+ | |||
+ | |||
[https://www.jianshu.com/p/2181b2e27021 Docker版MongoDB的安装] | [https://www.jianshu.com/p/2181b2e27021 Docker版MongoDB的安装] |
2021年4月25日 (日) 08:20的版本
cat docker-compose.yml version: "3" services: mongodb: image: mongo:4.2 container_name: mongodb4.2 ports: - "27017-27019:27017-27019" volumes: # - /Users/Pie/docker-lnmp/conf/mongodb/:/etc/mongo/:rw - /data/db_data/mongodb/:/data/db/:rw - /data/log/mongodb/:/var/log/mongodb/:rw environment: #设置后台登录用户和密码,没设置默认为:guest/guest MONGO_INITDB_ROOT_USERNAME: "root" MONGO_INITDB_ROOT_PASSWORD: example36 TZ: "Asia/Shanghai" restart: always networks: - default