C
C
Cat Scientist2016-03-22 20:22:17
Node.js
Cat Scientist, 2016-03-22 20:22:17

Have I understood the Docker philosophy correctly?

I just started getting into Docker and I love it. But before creating my first working stack, I would like to make sure that I understand everything correctly. Here's how I see a web application that runs on a bunch of nginx + Node.js + MongoDB:

  1. nginx
    • HTTP server
    • config
    • Logs
  2. Node.js
    • Engine (Node.js itself)
    • Application source code
    • npm modules
      • Global
      • Local
    • Application config
    • Logs
  3. MongoDB
    • DBMS server
    • Database
    • config
    • Logs

How it will be in Docker:
  1. images
    1. nginx
    2. Node.js and global npm modules
    3. Source code and local npm modules (or is it better to put it in the previous container and execute it at startup  npm install?)
    4. DBMS
  2. Data containers
    1. Database
  3. On the host file system
    1. Logs (but, as I understand it, this slightly violates the principle of isolation. If so, where are they? In a separate container?)
    2. All configs (or is it better to put the entire configuration in the Dockerfile?)

Did I make mistakes somewhere? Could you please correct me in 1.c., 3.a., 3.b.?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2016-03-22
@eruditecat

Data containers

They are not needed, use named volumes instead (as of docker version 1.9).
No, npm install must be done BEFORE building the image. When the container starts, it should already have everything inside. Again, I personally am against putting the project sources into a separate empty container. You have a container with a node - the source for the node should be there. There are some nuances associated with the assembly of the container, but this is so.
Nothing.
The logs are piped to stdout/stderr of the container and collected on the host via docker by any suitable driver (read the documentation).
Configuration - everything that changes in configs from environment to environment - in ENV variables. Everything else - does not change and therefore simply sewn into the container.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question