Warm tip: This article is reproduced from serverfault.com, please click

How can I run NodeJS in Docker with MongoDB and RabbitMQ?

发布于 2020-11-28 11:35:43

How can I run NodeJs in Docker and Connect it with MongoDB and RabbitMQ? Do I need to run it in with docker-compose?

And also I need 2 environment

  1. Run nodejs application in a development environment with nodemon.
  2. The Second environment is production experiment node app.js

I found this docker-compose yml, but I can not understand how to connect it from nodejs

services:
    rabbitmq:
        image: rabbitmq:3-management-alpine
        container_name: rabbitmq
        environment:
            RABBITMQ_ERLANG_COOKIE: ${RABBITMQ_ERLANG_COOKIE}
            RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER}
            RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS}
Questioner
Nasimi Mamedov
Viewed
0
Nasimi Mamedov 2020-11-30 19:44:57

After a few days, I found this repo with RabbitMQ, MongoDB. Also here you can find Mongo-express, where you can work with Mongo directly.

https://github.com/stdakov/docker-rabbit-mongo

Installation:

git clone https://github.com/stdakov/docker-rabbit-mongo.git
cd docker-rabbit-mongo/
docker-compose up -d