Infrastructure strategy

Hi, I am relatively new to docker, but already found it very useful.

Now I am hesitating between different possible ways of setting up my infrastructure.

My infrastructure :

3 or more web applications written in PHP/Ruby/NodeJS. Just for this example consider that they are all written in PHP.

So I have 3 web applications, all of them are running on the same stack - LAMP .

I used to build decoupled and modular application, so in this case I also try to somehow decouple apps.

Possible ways :

  1. Install everything on one server without using Docker at all.

  2. Create a single custom container for each applications, keeping all required software in it. For example a single container will have a whole LAMP stack installed without using separate containers for L, A, M and P. I know this violates some concepts of Docker.

  3. Construct a web app from multiple containers, separating Mysql and Apache,

Personally I prefer the second option, but I know that it violates some rules and best practices.

The problem with the third option that I don’t want to see something like the from the docker ps output.

apache_for_1st_app
apache_for_2nd_app
mysql_for_1st_app
mysql_fro_2nd_app
.....

I want to have as many containers as many containers as the number of webapps.

So I hope you get my question.

I would be grateful for any advice.

One thing to consider with having the whole infrastructure stack in the same container is that you can’t properly scale out the (hopefully) stateless web app to multiple containers since each has its own database.