Skip to content

Setting up MongoDB with Docker

Pablo Ojanguren edited this page Mar 20, 2017 · 1 revision

Setting up MongoDB with Docker

In this page you can know how to run a docker image of MongoDB to be used with SwellRT.

Create data directories

MongoDB files can be stored in the host machine. We will put them at /var/local/lib/swellrt-demo/db

Create and run Mongodb image

sh docker run --name demo-swellrt-mongo -v /var/local/lib/swellrt-demo/db:/data/db -d mongo

Then you must edit config/application.conf and configure SwellRT to use that mongodb server.

mongodb_host = demo-swellrt-mongo

Run image

Finally, exec the run the SwellRT docker image command with the --link demo-swellrt-mongo:mongo option

Access to MongoDB console

See what instances are running

docker ps

Get the IP address of the instance

docker inspect <name>

Run mongo command with the IP

mongo --host <ip>