Should I create a container for each site/app or can I put them all in the same one?

Asked

Viewed 302 times

1

I’m starting to study Docker, I’ve been playing a little bit on a VPS server that I have, but still some doubts persist.

I already understood that it is good practice to separate the database and the system itself into containers, but I must create a container for each site I want to host or I can simply create a container with apache and PHP and run several sites inside, but linking to the mysql container?

I know the doubt may be a little basic, but it’s just that the concept is not very clear

  • 4

    You can do it both ways. What determines this is why you use a container or not. You who choose what to separate and what not, according to your needs. First of all, do you really need a container? On the other hand, if it’s just exercise, do separate version and test, and do version without separate and test. So you know how to make the 2 (or more) ways. The way the question looks, it’s a matter of opinion, but maybe with a click on [Edit] putting more details of the need.

2 answers

1

If you are thinking of good practices, yes, each site in a container. This so that you actually benefit from the isolation, and ensure that one does not impact the other, and can monitor and isolate the consumption of resources individually, including protecting you in case of a possible downtime.

0

I recommend this creation as there is also the possibility that you can reuse some container already created, to climb only one specific site you can work with the Docker-Composer and thus isolate the sites in several Composers.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.