L
L
LionG2020-10-23 19:16:52
Node.js
LionG, 2020-10-23 19:16:52

Docker container for each application or docker container with pm2 and all applications?

There are several nodejs applications, what is the best way to run them in production ?

If you run a container for each application, then the application becomes the main process and this supports the Docker idea. For example, if the application crashes, docker will restart it. All applications will be isolated.

If you run applications through pm2 in a container, then pm2 becomes the main processor.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Shumov, 2020-10-23
@inoise

one application - one container. each container has its own pm2

W
wassapman72, 2020-10-27
@wassapman72

pm2 is essentially a supervisor, one of the functions of docker is also essentially a supervisor, it will work anyway, whether you follow the docker way or not, this decision is up to you, but if you don’t follow it, you get a set of problems on the long run, at least:
1. in case of transition When using orchestration tools, you will not be able to apply some features or troubleshooting/monitoring/scaling tools, and some of them will not work correctly.
2. you violate the "standard", and anyone who will work with your solution with you or after you will need to understand its essence (as well as figure out exactly how you solve problems and why in this way).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question