Docker中的主管不起作用

时间:2018-08-08 12:38:19

标签: docker supervisord

我在supervisor中遇到docker的问题。我使用supervisor启动4个.sh脚本:datagrid.shml.shstartmap.shdirwatcher.sh

当我打开容器时,导航到scripts目录并尝试手动启动脚本,一切正常,脚本全部启动,但它们没有在启动时间启动。我认为问题出在主管。谢谢。

错误:

2018-08-08 12:28:08,512 INFO spawned: 'datagrid' with pid 171
2018-08-08 12:28:08,514 INFO spawned: 'dirwatcher' with pid 172 
2018-08-08 12:28:08,517 INFO spawned: 'startmap' with pid 173 
2018-08-08 12:28:08,519 INFO spawned: 'ml' with pid 175 
2018-08-08 12:28:08,520 INFO exited: datagrid (exit status 0; not expected)
2018-08-08 12:28:08,520 INFO exited: dirwatcher (exit status 0; not expected)
2018-08-08 12:28:08,520 INFO exited: startmap (exit status 0; not expected)
2018-08-08 12:28:08,520 INFO exited: ml (exit status 0; not expected)
2018-08-08 12:28:08,527 INFO gave up: datagrid entered FATAL state, too many start retries too quickly
2018-08-08 12:28:08,532 INFO gave up: ml entered FATAL state, too many start retries too quickly
2018-08-08 12:28:08,537 INFO gave up: startmap entered FATAL state, too many start retries too quickly
2018-08-08 12:28:08,539 INFO gave up: dirwatcher entered FATAL state, too many start retries too quickly

我的supervisord.conf文件:

[supervisord]
nodaemon=false

[program:datagrid]
command=sh /EscomledML/MLScripts/escomled_data_grid.sh start -D

[program:dirwatcher]
command=sh /EscomledML/MLScripts/escomled_dirwatcher.sh start -D

[program:startmap]
command=sh /EscomledML/MLScripts/escomled_startmap.sh start -D

[program:ml]
command=sh /EscomledML/MLScripts/escomled_ml.sh start -D

我在容器中使用了alpine linux。

1 个答案:

答案 0 :(得分:0)

这里有几个问题

  1. 以下语句:

    [主管] nodaemon = false

这使Supervisord作为守护程序运行,并且容器需要一个主进程。

尝试将其更改为

[supervisord]
nodaemon=true

此配置使Supervisord本身作为前台进程运行,这将使容器保持正常运行。

  1. 从日志中 '520信息已退出:datagrid(退出状态0;未预期)'

Supervisord无法将0识别为有效的退出代码,并且正在退出进程。将以下内容添加到所有进程的conf中。这将告诉Supervisord仅在退出代码不为0时尝试重新启动该过程。

[program:datagrid]
command=sh /EscomledML/MLScripts/escomled_data_grid.sh start -D
autorestart=unexpected
exitcodes=0