2 services on the same container

Hello,

I’m a beginner to Docker.
Just a simple question. Why installing 2 services like WordPress and MySQL on the same container not the best practice? Why should I separate them into 2 different containers?

I mean what is the real benefit of this separation over installing them in the same container.

Regards,

  1. Scaling. Wordpress itself can scale with more copies whereas MySQL does not normally. So you can have more than one wordpress being load balanced across nodes.

  2. Port management, with everything in one container, you need to manage more ports yourself mind you it isn’t too bad with two or three services, but it gets really annoying when you have a lot.

  3. Image size. Having all of them in one container means a larger image size, if you want to update your image it will take longer

1 Like