Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
746 views
in Technique[技术] by (71.8m points)

mongodb - docker-compose mongo-init.js file working but not sure if I used best practice

I created a docker-compose.yml to pull a bunch of apis and initialize a mongo db instance with some pre-pupulated data, have my docker-compose file, and my mongo-init.js file is located in the root of the project (src/mongo-init.js)

it builds the project and seeds the database, but it also creates extra folders and files in the project I wasn't expecting, a .docker/mongodb/initdb.d directory, and a mongo directory with init-mongo.js and mongo-volume which has a bunch of files in, index-1--441...wt, WiredTiger.lock, etc

  • docker-compose.yaml
version: '3.4'
services:
  mongo:
    image: mongo:latest
    container_name: mongodb
    hostname: mongodb
    ports:
      - '27017-27019:27017-27019'
    volumes:
      - ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro

thanks in advance for any help


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...