The Docker best practices guide states that:
"...you should only run a single process in a single container..."
Should Nginx and PHP-FPM run in separate containers? Or does that mean that micro service architectures only run one service or "app" in a container?
Having these services in a single container seems easier to deploy and maintain.
Depending on the use case, you can run multiple processes inside a single container, although I won't recommend that.
In some sense it is even simpler to run them in different containers. Keeping containers small, stateless, and around a single job makes it easier to maintain them all. Let me tell you how my workflow with containers is in a similar situation.
So:
Having this structure, the deployment is modular, so each and every "service" is separated and logically independent from the rest of the system.
As a side effect, in this particular case, you can do zero-downtime deployments (updates) to the application. The idea behind this is simple. When you have to do an update, you create a docker image with the updated application, run the container, run all the tests and maintenance scripts and if everything goes well, you add the newly created container to the chain (load balancer), and softly kill the old one. That's it, you have the updated application and users didn't even notice it at all.
This means process in the Linux/Unix sense of the word. That said, there's nothing stopping you from running multiple processes in a container, it's just not a recommended paradigm.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With