On the basis of the official centos started a container, installed in the PHP-FPM. now I want this container to run in the background, and another container (such as the NGINX server container) is connected to its PHP-FPM service. The following is my startup parameter: {code ...} {code ...} the container does not seem to be... on the basis of the official centos started a container, installed in the PHP-FPM.
Now I want this container to run in the background, and another container (such as the NGINX server container) will connect to its PHP-FPM Service
The following are my startup parameters:
# Test/php is the image name docker-d -- name php-fpm test/php/usr/sbin/php-fpm
docker -d --name php-fpm test/php /usr/sbin/php-fpm -D #daemonize
In the container, it seems that php-fpm cannot be started through the service.
[root@5233bbc57e72 /]# systemctl start php-fpmFailed to get D-Bus connection: No connection to service manager.
So install a supervisor.
#/etc/supervisord.conf[supervisord]logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)logfile_backups=10 ; (num of main logfile rotation backups;default 10)loglevel=info ; (log level;default info; others: debug,warn,trace)pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)nodaemon=true ; (start in foreground if true;default false)minfds=1024 ; (min. avail startup file descriptors;default 1024)minprocs=200 ; (min. avail process descriptors;default 200);umask=022 ; (process file creation umask;default 022);user=chrism ; (default is current user, required if root);identifier=supervisor ; (supervisord identifier, default is 'supervisor');directory=/tmp ; (default is not to cd during start);nocleanup=true [include]files = supervisord.d//*.ini[program:php-fpm]command=/bin/bash -c "/usr/sbin/php-fpm -D"
Start
docker run -d test/php /usr/bin/supervisord
If the container can be maintained in the background, but php-fpm is not started!
The configuration of php-fpm is default.
Reply content:
On the basis of the official centos started a container, installed in the PHP-FPM.
Now I want this container to run in the background, and another container (such as the NGINX server container) will connect to its PHP-FPM Service
The following are my startup parameters:
# Test/php is the image name docker-d -- name php-fpm test/php/usr/sbin/php-fpm
docker -d --name php-fpm test/php /usr/sbin/php-fpm -D #daemonize
In the container, it seems that php-fpm cannot be started through the service.
[root@5233bbc57e72 /]# systemctl start php-fpmFailed to get D-Bus connection: No connection to service manager.
So install a supervisor.
#/etc/supervisord.conf[supervisord]logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)logfile_backups=10 ; (num of main logfile rotation backups;default 10)loglevel=info ; (log level;default info; others: debug,warn,trace)pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)nodaemon=true ; (start in foreground if true;default false)minfds=1024 ; (min. avail startup file descriptors;default 1024)minprocs=200 ; (min. avail process descriptors;default 200);umask=022 ; (process file creation umask;default 022);user=chrism ; (default is current user, required if root);identifier=supervisor ; (supervisord identifier, default is 'supervisor');directory=/tmp ; (default is not to cd during start);nocleanup=true [include]files = supervisord.d//*.ini[program:php-fpm]command=/bin/bash -c "/usr/sbin/php-fpm -D"
Start
docker run -d test/php /usr/bin/supervisord
If the container can be maintained in the background, but php-fpm is not started!
The configuration of php-fpm is default.
- Directly use the official PHP Docker image.
Https://registry.hub.docker.com/_/php/
- View how to use the dockerfile of the official Docker image.
Https://github.com/docker-library/php/blob/32887c1de338d0ad582393b5f1d...