docker-php 合并Supervisor进程守护(双进程)
-
1、 docker 下载 Supervisor
RUN apt-get install -y supervisor2、配置
创建被守护的进程vi ***.conf [program:laravel-worker] process_name=%(program_name)s_%(process_num)02d command=php /var/www/html/artisan queue:work --timeout=30000 --queue=default --delay=1 --sleep=1 --tries=1 autostart=true autorestart=true user=root numprocs=1 redirect_stderr=true stdout_logfile=/var/www/html/worker.log2、配置文件添加到Docker
ADD ./laravel-worker.conf /etc/supervisor/conf.d/3、配置双进程命令
vi **.sh #!/usr/bin/env bash /usr/bin/python2 /usr/bin/supervisord -c /etc/supervisor/supervisord.conf supervisorctl update supervisorctl start laravel-worker:* docker-php-entrypoint php-fpm4、将sh文件添加到Docker并且执行
ADD ./supervisorctl.sh /var/www/html/supervisorctl.sh RUN chmod +x /var/www/html/supervisorctl.sh ENTRYPOINT ["sh","./supervisorctl.sh"]5、然后进行打包、启动
注:查看docker进程命令
docker ps --no-trunc |grep php