在Docker构建镜像时,如何设置程序的自启动?
创建容器时,指定程序自动启动。
如何同时运行多个程序?
比如我自建一个LTMP(Tengine)容器,如何使mysql、Tengine跟随容器的启动而启动?
业精于勤,荒于嬉;行成于思,毁于随。
Configure the Supervisor daemon to start related services!
The program auto-start can be configured when building the image. This has nothing to do with docker
You can set dependencies and manage multiple services in the docker-compose configuration file docker-compose.yml.
When you build the image, add it below the Dockerfile
CMD /etc/bootstrap.sh
Then write the script you want to start. Of course, the file location and file name can be changed
When the container is started, the script you want will be automatically executed
Then you can start the service you want in the script and you are done!
Configure the Supervisor daemon to start related services!
The program auto-start can be configured when building the image. This has nothing to do with docker
You can set dependencies and manage multiple services in the docker-compose configuration file docker-compose.yml.
When you build the image, add it below the Dockerfile
Then write the script you want to start. Of course, the file location and file name can be changed
When the container is started, the script you want will be automatically executed
Then you can start the service you want in the script and you are done!