How to restart php-fpm inside a docker container?

2019-03-12 14:44发布

I'm using docker and my container is build over php:5.6-fpm image from php official repo. Is it somehow possible to restart/reload php-fpm from inside a container?

标签: php docker
3条回答
成全新的幸福
2楼-- · 2019-03-12 15:23

You don't have to go inside the container

on your host ps -ef|grep fpm // find master pid kill -USR2 <master_pid>

查看更多
ゆ 、 Hurt°
3楼-- · 2019-03-12 15:28

php-fpm is a process manager which supports the USER2 signal, which is used to reload the config file.

From inside the container:

kill -USR2 1

Outside:

docker exec -it <mycontainer> kill -USR2 1

Complete example:

docker run -d --name test123 php:7.1-fpm-alpine
docker exec -it test123 ps aux
docker exec -it test123 kill -USR2 1
docker exec -it test123 ps aux
查看更多
贪生不怕死
4楼-- · 2019-03-12 15:35

You can also just restart the container..

sudo docker <container> restart
查看更多
登录 后发表回答