Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Docker的主管没有';行不通_Docker_Supervisord - Fatal编程技术网

Docker的主管没有';行不通

Docker的主管没有';行不通,docker,supervisord,Docker,Supervisord,我与docker中的supervisor有问题。我使用supervisor启动4个.sh脚本:datagrid.sh,ml.sh,startmap.sh和dirwatcher.sh 当我打开容器时,导航到脚本目录并尝试手动启动脚本,一切正常,脚本都会启动,但不会在启动时启动。我想问题出在主管身上。多谢各位 错误: 2018-08-08 12:28:08,512 INFO spawned: 'datagrid' with pid 171 2018-08-08 12:28:08,514 INFO s

我与
docker
中的
supervisor
有问题。我使用
supervisor
启动4个
.sh
脚本:
datagrid.sh
ml.sh
startmap.sh
dirwatcher.sh

当我打开容器时,导航到脚本目录并尝试手动启动脚本,一切正常,脚本都会启动,但不会在启动时启动。我想问题出在主管身上。多谢各位

错误:

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。

这里几乎没有问题

  • 声明如下:

    [主管] nodaemon=false

  • 这使得Supervisord作为守护进程运行,容器需要一个主进程

    试着把它改成

    [supervisord]
    nodaemon=true
    
    此配置使Supervisord本身作为前台进程运行,这将保持容器正常运行

  • 从日志中 “520信息已退出:datagrid(退出状态0;不应为)”
  • Supervisord无法将0识别为有效的退出代码,正在退出进程。将以下内容添加到所有进程的conf中。这将告诉Supervisord仅当退出代码不是0时才尝试重新启动进程

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

    尝试一些人在docker中使用它:我是docker的新手,你能给我更多的信息吗?也许这会有帮助:它会继续运行这个Hello,我似乎无法使
    不朽。运行
    开始工作。我不知道在容器中指定要运行的脚本的位置。你能帮我吗?嗨,只需克隆repo并在dir do
    docker build-t test personal
    中执行,然后
    docker run-it--privileged test personal.
    我一直在寻找一个类似问题的解决方案,效果非常好!为什么我们不能有两个主流程?我们需要docker上下文之外的配置吗?如果我们使用的是apache,为什么还要停止apache呢?