While this is possible it is not a best practice. Whenever possible, containers should contain a single process. The reasoning for this is:
- It fosters a modular design where you can more easily plug and play components. What if you decide not to use nginx and use asp.net core in the future? If everything is tightly coupled in one container then the entire container will need to be reworked any time one of these components changes. Look into microservices for more information on the benefits a modular design.
- It is easier to parse container logs as each container will have its own distinct output.
- If a process crashes and everything is in one container, the entire container will crash. If you have them broken out across multiple containers, recovery is simplified. While this may not be applicable for running standalone containers, it is very useful if the containers are running in a Kubernetes Pod as the Pod can restart.