Skip to content
Advertisement

How can I start php-fpm in a Docker container by default?

I have this Docker image –

JavaScript

Basically, I want it so that php-fpm starts when the docker container starts. I have php-fpm working if I manually go into the container and turn it on with /usr/sbin/php-fpm.

I tried it inside of my ansible file with this command (it didn’t work). I tried using the service module as well with no luck.-

JavaScript

How can I have php-fpm running along with apache?

Advertisement

Answer

You should use supervisor in order to launch several services

In your dockerfile, install supervisor, then you launch

JavaScript

And your docker/supervisord.conf contains all the services you want to start, so you can have something like that

JavaScript

Of course you should adapt with your path and php-fpm versions and your services (nginx in my example, apache for you etc…), but basically supervisor is the best way to manage the start of several services from one start point.

Here you can find the official doc of docker about supervisor

https://docs.docker.com/engine/admin/using_supervisord/

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement