習慣沉默2017-04-27 09:04:16
Docker recommends one container and one service. You can split nginx, mysql, PHP-FPM (PHP) into different containers. After you split it, you can use docker's restart mechanism to ensure the availability of the service. You can refer to me This way docker-node.js
曾经蜡笔没有小新2017-04-27 09:04:16
The principle of docker is that the container run by docker run is essentially just a process, and the backend calls various system calls to isolate it, making it look like a virtual machine.
Docker run The running process and its sub-processes, as long as the main process does not die, the docker container will not hang.
Based on this, we can regard supervisord as the main process and start php and nginx together. The php and nginx processes are managed by supervisord.
Ready-made dockerfile.
supervisord process management+nginx+php7
php+nginx+supervisord dockerfile:
https://github.com/qiukeren/d...
Well, salt-minion will be installed at the same time. If you don’t need it, just customize it yourself.
Project address:
https://github.com/qiukeren/d..., directly execute bash build.sh
to generate a container.
巴扎黑2017-04-27 09:04:16
The answer above did not solve the problem
This article can solve the poster’s problem
https://javablog.net/page/250...
No one can stop you if you have to run multiple processes in one dock. Feel free
淡淡烟草味2017-04-27 09:04:16
Make sure that lnmp is also started after the container is started. Make sure that nginx mysql php is started in the foreground, otherwise the container detects that these processes have left the container and started in the background, and the container itself will automatically close. Regarding the containerization of lnmp, you can refer to https://www.centos.bz/2017/02...