I'm new to Docker.
Can you please have a look at my scheme attached below?
The plan
What I want is to be able to have an amount of isolated docker containers with the current software onboard:
- NodeJs (npm, pm2, grunt-cli etc.)
- MongoDb
- other software (cron, ffmpeg etc.)
Every isolated container is linked to the same volume with the application code but is started with different ENV vars: expressJS port, db name and etc. You got me, right?
For example we have 2 isolated containers:stack1
and stack2
.
Both of them use the same volume with app code located at /home/user/app_code/ (volume mount) at the host machine.
NodeJS inside stack1
is started on 3001 port and is connected to its mongoDB server that uses DB at /home/user/db1 (volume mount) and has its dedicated storage for multimedia located at /home/user/storage1
NodeJS inside stack2
is started on 3002 port and is connected to its mongoDB server that uses DB at /home/user/db2 (volume mount) and has its dedicated storage for multimedia located at /home/user/storage2
And of course stack1
and stack2
are placed behind the Nginx single container reverse proxy.
The question
What's the best way to implement my plan?
As I understand it docker-compose
is not the right tool in my case. In the end I can build only stack that consists if nodeJs image and Mongo image. But how to deal with ffmpeg and cron? How to multiply stacks? Is it possible to put them behind sinle Nginx container?
The second way is to take "phusion/baseimage-docker", manually install NodeJs, Mongodb, ffmpeg, multiply this container and hide each behind the Nginx revese proxy. But this approach violates a bit Best practices for writing Dockerfiles (Run only one process per container)
Or is there another proper way? How would you implement this architecture?
Thank you in advance!