docker-compose.yml文章来源:https://www.toymoban.com/news/detail-703264.html
version: '3.8'
services:
# Database - Mongo DB
mongo:
image: mongo:7.0.0
restart: on-failure
environment:
MONGO_INITDB_ROOT_USERNAME: test
MONGO_INITDB_ROOT_PASSWORD: test123
ports:
- "27017:27017"
volumes:
- ./docker-entrypoint-initdb.d/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
- ./data/mongodb-data:/data/db
- ./data/mongodb-log:/var/log/mongodb
/docker-entrypoint-initdb.d/mongo-init.js文章来源地址https://www.toymoban.com/news/detail-703264.html
db = db.getSiblingDB('db01');
db.createCollection('test_collection');
db.test_collection.insertMany([
{
org: 'helpdev',
filter: 'EVENT_A',
addrs: 'http://rest_client_1:8080/wh'
},
{
org: 'helpdev',
filter: 'EVENT_B',
addrs: 'http://rest_client_2:8081/wh'
},
{
org: 'github',
filter: 'EVENT_C',
addrs: 'http://rest_client_3:8082/wh'
}
]);
到了这里,关于Mongo DB docker compose 安装配置的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!