How to start another process when running springboot in docker container

  docker, question

We often encounter a problem when running springboot projects in a docker-based test environment. Occasionally, there is a problem with the developed code, which causes springboot to fail to start, because springboot (that is, java process) is the main process of the container, thus the container fails to start, triggering marathon/k8s health check failure, and then restarting the project frequently. However, due to the test environment, the developer wants to look at the “accident scene” and frequently restarts and loses the “accident scene”.

In order to solve this problem, I plan not to use java thread as the main process, so I need to use components such as supervisor. Does your company have a container multi-process scenario? What are the best practices?

You have a wrong understanding of docker. According to docker’s design, a container has and only has one process. Running multiple processes is not a docker application scenario, and docker also believes that it should not do so.