A container in docker can not only run one application; as long as the resources are sufficient, multiple applications can be run in a container. However, running multiple applications in a container has many disadvantages, which violates the original intention of the container. Containers must be lightweight; if applications are placed together, it may cause problems with one process and make all processes inaccessible.
The operating environment of this tutorial: linux7.3 system, docker version 19.03, Dell G3 computer.
You can run multiple applications in a container. As long as you have enough resources, you can run it, but this goes against the original intention of the container, which is to To achieve lightweight and isolation, it makes no sense to put applications together
Deploying multiple processes in one container has many disadvantages. For example, when updating the image of a certain process, other processes will also be forced to restart. If a problem occurs in one process and the container hangs, all processes will be inaccessible.
It is not recommended to run multiple programs directly in a single Docker container.
Taking Docker’s official support for Kubernetes on October 18, 2017 as a watershed calculation, it has been more than a year since Kubernetes won the final victory in the container orchestration battle. Let’s first take a look at the classic Kubernetes architecture diagram:
#As you can see, in Kubernetes, the smallest deployment unit for creation, scheduling and management is Pod, not container. In scenarios without containerization technology, containers under the same Pod run on the same physical or virtual host. Data and communication can be easily shared between these containers, and individual containers can be independently rebuilt and redeployed.
Follow the single principle, a container only runs one main process.
Multiple processes are deployed in a container, which has many disadvantages. For example, when updating the image of a certain process, other processes will also be forced to restart. If a problem occurs in one process and the container hangs, all processes will be inaccessible.
Based on the principles advocated by the official website.
Container = the execution environment that the application depends on
Rather than deploying a bunch of processes together like a virtual machine.
Recommended learning: "docker video tutorial"
The above is the detailed content of Can a docker container only run one application?. For more information, please follow other related articles on the PHP Chinese website!