Docker,Supervisord和supervisor-stdout

我试图使用supervisor-stdout来集中来自supervisord的输出和它的进程。 但有了这个supervisordconfiguration:

 #supervisord.conf [supervisord] nodaemon = true [program:nginx] command = /usr/sbin/nginx stdout_events_enabled = true stderr_events_enabled = true [eventlistener:stdout] command = supervisor_stdout buffer_size = 100 events = PROCESS_LOG result_handler = supervisor_stdout:event_handler 

(请注意,supervisor-stoud的configuration部分与supervisor-stoud站点上的示例完全相同)。

…和这个Dockerfile:

 #Dockerfile FROM python:3-onbuild RUN apt-get update && apt-get install -y nginx supervisor # Setup supervisord RUN pip install supervisor-stdout RUN mkdir -p /var/log/supervisor COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY nginx.conf /etc/nginx/nginx.conf # restart nginx to load the config RUN service nginx stop # Start processes CMD supervisord -c /etc/supervisor/conf.d/supervisord.conf -n 

我可以很好地构build图像,但从中运行一个容器给我:

错误:supervisor_stdout:event_handler无法在[eventlistener:stdout]中parsing

编辑

运行的输出:

supervisord -c /etc/supervisor/conf.d/supervisord.conf -n

是:

 Error: supervisor_stdout:event_handler cannot be resolved within [eventlistener:stdout] For help, use /usr/bin/supervisord -h 

我有完全相同的问题,并通过使用Ubuntu 14.04而不是Debian Jessie (我使用基于Jessie的python:2.7映像)来解决它。

你可以参考这个完整的工作实现: https : //github.com/rehabstudio/docker-gunicorn-nginx 。

编辑:正如@ Vin-G在他的评论中指出的,这可能是因为Debian Jessie附带的主pipe版本太老了。 你可以尝试从apt中删除它,并用pip来安装它。

我有同样的问题,简而言之,您需要安装提供supervisor_stdout:event_handler处理程序的Python包。 您应该可以通过发出以下命令:

 apt-get install -y python-pip pip install supervisor-stdout 

如果你在那个容器上安装了pip ,一个简单的:

pip install supervisor-stdout就足够了,关于这个特定软件包的更多信息可以在这里find:

https://pypi.python.org/pypi/supervisor-stdout

AFAIK,没有提供主pipe标准输出的debian软件包,所以安装它的最简单的方法是通过点。

希望它能帮助像我一样来到这里的人。

[编辑]由于Vin-G的build议,如果你经历了这些步骤仍然有问题,supervisord可能会卡住在一个旧版本。 尝试更新它。

干杯!

非常类似于上述,但我不认为有一个完整的答案。

我不得不从apt中删除

 apt-get remove supervisor 

然后用pip重新安装,但用pip2作为当前版本的主pipe不支持python 3

 apt-get install -y python-pip pip2 install supervisor pip2 install supervisor-stdout 

这一切然后工作。

虽然supervisord的path是现在

 /usr/local/bin/supervisord 

希望有所帮助。