You must use supervisor to run multiple services
In your docker file, install the dispatcher, then you run
COPY ./docker/supervisord.conf /etc/supervisord.conf .... CMD ["/usr/bin/supervisord", "-n"]
And your docker/supervisord.conf contains all the services you want to run, so you can have something like this
[program:php-fpm] command=/opt/remi/php70/root/usr/sbin/php-fpm -c /etc/php-fpm.conf ;command=/usr/sbin/php70-fpm -c /etc/php-fpm.d stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 [program:nginx] command=/usr/sbin/nginx stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0
Of course, you should adapt to your php-fpm paths and versions and your services (nginx in my example, apache for you, etc.), but basically a supervisor is the best way to control the launch of several services from one starting point.
Here you can find the docker white paper on supervisor
https://docs.docker.com/engine/admin/using_supervisord/
source share