Reputation: 655
I've done a lot of research but not sure if i understand correctly, The considered "best practice" for deployment on docker is to have a single process per container.
Couple of questions about it:
The meaning is that it's best to have a single service (for example, a single app), but this app can be have multiprocess architecture - right or wrong?
Is there any actual limit on this in the container? For example if i "ignore" the advised best practices and try to spawn multiple processes in my app? will it fail?
Upvotes: 2
Views: 1491
Reputation: 398
Dockers can run as many processes as the underlaying cgroup allow, there will be one foreground process where the stdout is the docker log. If that process stops, your container will stop. Best practice is to do one thing with your container that is isolated from the other services except where you define the interface. For instance open the port for the webservice. Doing one thing will make the docker images portable and potentially scalable.
Upvotes: 1
Reputation: 121881
[It's best practice...] to have a single service (for example, a single app). TRUE
[If I...] try to spawn multiple processes in my app? will it fail? NO
The considered "best practice" for deployment on docker is to have a single process per container. NO - NOT NECESSARILY.
The idea is that your "service" should be as "stripped down" as possible; relying on OTHER "services" (possibly in other containers) as-needed. Run as little in your container as you need - but no less.
Upvotes: 2