Search code examples
dockerphp-7fpm

How to start PHP7.0-FPM in Dockerfile?


By going through all answers I could find, I don't seem to be able to launch fpm 7. If I go into the container and I manually run: service php7.0-fpm start everything works fine.

What I have tried I:
CMD ["nginx", "-g", "daemon off;", "php7.0-fpm"]

What I have tried II:
CMD ["php7.0-fpm", "nginx", "-g", "daemon off;"]

What I have tried III:
CMD ["php-fpm7.0", "nginx", "-g", "daemon off;"]

What I have tried IV:
RUN service php7.0-fpm start
CMD ["php-fpm7.0", "nginx", "-g", "daemon off;"]

PS:
Nginx works fine.

PPS:
I would like to avoid the usage of supervisor if possible.


Solution

  • I was on the same issue with you and I had done dozens of combinations then I found the one that works!

    Since CMD overridden each other, we have to combine the commands into the same line with &&.

    Here is what I have done.

    CMD service php7.0-fpm start && nginx -g "daemon off;"