PHPfpm和Nginx在Docker中没有使用Supervisord

时间:2016-12-10 15:19:06

标签: php nginx docker dockerfile supervisord

我在docker容器中运行了2个进程,一个Nginx服务器和带有supervisord的PHP-FPM,但它只是继续退出状态1(意外)

以下是日志

2016-12-09 21:37:35,529 CRIT Supervisor running as root (no user in config file)
2016-12-09 21:37:35,596 INFO RPC interface 'supervisor' initialized
2016-12-09 21:37:35,598 INFO supervisord started with pid 1
2016-12-09 21:37:36,602 INFO spawned: 'nginx' with pid 7
2016-12-09 21:37:36,606 INFO spawned: 'php-fpm' with pid 8
2016-12-09 21:37:36,671 INFO exited: nginx (exit status 1; not expected)
2016-12-09 21:37:36,722 INFO exited: php-fpm (exit status 1; not expected)
2016-12-09 21:37:37,727 INFO spawned: 'nginx' with pid 20
2016-12-09 21:37:37,737 INFO spawned: 'php-fpm' with pid 21
2016-12-09 21:37:37,801 INFO exited: nginx (exit status 1; not expected)
2016-12-09 21:37:37,848 INFO exited: php-fpm (exit status 1; not expected)
2016-12-09 21:37:39,856 INFO spawned: 'nginx' with pid 33
2016-12-09 21:37:39,863 INFO spawned: 'php-fpm' with pid 34
2016-12-09 21:37:39,917 INFO exited: nginx (exit status 1; not expected)
2016-12-09 21:37:39,997 INFO exited: php-fpm (exit status 1; not expected)
2016-12-09 21:37:43,007 INFO spawned: 'nginx' with pid 46
2016-12-09 21:37:43,011 INFO spawned: 'php-fpm' with pid 47
2016-12-09 21:37:43,071 INFO exited: nginx (exit status 1; not expected)
2016-12-09 21:37:43,072 INFO gave up: nginx entered FATAL state, too many start retries too quickly
2016-12-09 21:37:43,130 INFO exited: php-fpm (exit status 1; not expected)
2016-12-09 21:37:43,132 INFO gave up: php-fpm entered FATAL state, too many start retries too quickly

我已将守护程序添加到Nginx和PHPFPM,但它仍然无效 这是Nginx.conf

user  nginx;
daemon off;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  120;

    gzip  on;

    include /etc/nginx/conf.d/*.conf;
}

我还运行了以下命令来关闭PHP-FPM中的守护进程

RUN sed -i 's/;daemonize = yes/daemonize = no/g' /usr/local/php-7.0.12/etc/php-fpm.conf

这是我的supervisord.conf文件

[supervisord]
nodaemon=true

[program:nginx]
command: service nginx start

[program:php-fpm]
command: service php-fpm start

[supervisorctl]
serverurl=http://localhost:8091

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[inet_http_server]
port = 8091

有人可以指导我如何在docker容器上的supervisord中运行这些进程吗?

Docker容器日志

/usr/lib/python2.7/site-packages/supervisor-3.3.1-py2.7.egg/supervisor/options.py:298: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
  'Supervisord is running as root and it is searching '
2016-12-09 22:06:43,939 CRIT Supervisor running as root (no user in config file)
2016-12-09 22:06:43,992 INFO RPC interface 'supervisor' initialized
2016-12-09 22:06:43,994 INFO supervisord started with pid 1
2016-12-09 22:06:44,999 INFO spawned: 'nginx' with pid 8
2016-12-09 22:06:45,003 INFO spawned: 'php-fpm' with pid 9
2016-12-09 22:06:45,065 INFO exited: nginx (exit status 1; not expected)
2016-12-09 22:06:45,124 INFO exited: php-fpm (exit status 1; not expected)
2016-12-09 22:06:46,131 INFO spawned: 'nginx' with pid 21
2016-12-09 22:06:46,138 INFO spawned: 'php-fpm' with pid 22
2016-12-09 22:06:46,223 INFO exited: nginx (exit status 1; not expected)
2016-12-09 22:06:46,275 INFO exited: php-fpm (exit status 1; not expected)
2016-12-09 22:06:48,282 INFO spawned: 'nginx' with pid 34
2016-12-09 22:06:48,288 INFO spawned: 'php-fpm' with pid 35
2016-12-09 22:06:48,346 INFO exited: nginx (exit status 1; not expected)
2016-12-09 22:06:48,426 INFO exited: php-fpm (exit status 1; not expected)
2016-12-09 22:06:51,435 INFO spawned: 'nginx' with pid 47
2016-12-09 22:06:51,443 INFO spawned: 'php-fpm' with pid 48
2016-12-09 22:06:51,526 INFO exited: nginx (exit status 1; not expected)
2016-12-09 22:06:51,528 INFO gave up: nginx entered FATAL state, too many start retries too quickly
2016-12-09 22:06:51,555 INFO exited: php-fpm (exit status 1; not expected)
2016-12-09 22:06:52,558 INFO gave up: php-fpm entered FATAL state, too many start retries too quickly

0 个答案:

没有答案