docker容器启动时里面的lnmp服务器如何也跟着启动
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-04-27 09:02:16
0
4
945

docker容器启动时里面的lnmp服务器如何也跟着启动?
启动后怎么保证容器不自动关闭?

曾经蜡笔没有小新
曾经蜡笔没有小新

reply all(4)
習慣沉默

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

曾经蜡笔没有小新

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.

巴扎黑

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

淡淡烟草味

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...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template