timebandit
timebandit

Reputation: 830

Configure Meteor to store Mongo data of the container and on the host

When using docker-compose to create two connected services; one for the app and one for the Mongo data. How do you configure the Mongo service to store it's data outside of the container ?

Upvotes: 1

Views: 211

Answers (1)

timebandit
timebandit

Reputation: 830

Take the following docker-compose file.

app:
  image: image-name
  command: meteor --settings settings-development.json
  volumes:
    - src-path-on-host:src-path-in-container
  ports:
    - "80:3000"
  links:
    - mongo
  environment:
    - ROOT_URL=http://example.com

Point Meteor to the mongodb container

    - MONGO_URL=mongodb://mongo:27017/meteor

.

mongo:
  image: mongo:latest
  ports:
    - "27017:27017"

Store the data outside the container

  volumes:
    - path-to-db-dat-on-host:/data/db

You can then connect to the db from a terminal using mongo localhost:27017 or just mongo and then use meteor

Upvotes: 2

Related Questions