How to restart php-fpm inside a docker container?

后端 未结 4 1653
天涯浪人
天涯浪人 2021-01-30 17:13

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?

4条回答
  •  北恋
    北恋 (楼主)
    2021-01-30 17:51

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

提交回复
热议问题