X
X
xilit2018-09-15 08:45:20
linux
xilit, 2018-09-15 08:45:20

Should I use each Docker container separately for each running process?

Hello. I'm reading the book "Using Docker" by Adrien Mowat. In the book, he says that the docker developers believe that it is most correct to use one process per container in the operation of containers. Tell me, does this mean that if I want to deploy a web server, then I need at least 3 containers:
1. DBMS
2. Web server
3. The site itself.
Or is it all unprincipled and everything can be put into one container and will work just as well.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
S
Stanislav Bodrov, 2018-09-15
@xilit

In the book, he says that the docker developers believe that it is most correct to use one process per container in the operation of containers.
That's right. This is the main paradigm when using containerization. Legs grow from 12 factors . You can use one picture
In some cases, you can deviate from it - the essence is not a dogma. These are cases when you need to keep a scheduler (crontab), a monitoring utility, or something else not related to the main process in the container with the application.
Tell me, does this mean that if I want to deploy a web server, then I need at least 3 containers
And there is. Further launch of all applications is carried out with one command. Since it turns out to be quite long (as if you are running a Java application), it is preferable to use docker-compose for this purpose. There is the only yaml file in which you can describe what to run in what order and, if necessary, restart, how much and what hardware resources to allocate to each application, and much more.
Or is it all unprincipled and everything can be put into one container and will work just as well.
It is possible to do so. The truth is that it is easier and more reasonable not to bother with containers in this case.

D
Dmitry Shitskov, 2018-09-15
@Zarom

1 DBMS
2 Web server
The site is usually located outside the container.
Or
1 DBMS
2 Front
3 Web application, which is a built image. Most often these are applications on nodejs, .net or python.

S
Sanes, 2018-09-15
@Sanes

More logs in a separate place and configs. This is insanity. Set up a normal virtual machine.

S
Sergey Ryzhkin, 2018-09-15
@Franciz

It should be without docker. Good manners rules: school separately, site separately.

Z
zlo1, 2018-09-15
@zlo1

MYSQL through a UNIX socket works faster if everything runs on the same hardware, I don’t advise splitting
it though ... if you make a public folder (tmp) for containers, you can give access to the UNIX socket

R
Roman Mirilaczvili, 2018-09-15
@2ord

For a web application, the main process is the web server serving client requests. It is worth isolating only it, and you need to connect it to the DBMS and file storage outside the container.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question