Milan Panic
Milan Panic

Reputation: 503

Supervisor in Docker doesn't work

I have a problem with supervisor in docker. I use the supervisor to start 4 .sh scripts: datagrid.sh, ml.sh, startmap.sh and dirwatcher.sh.

When I open the container, navigate to the scripts directory and try to start the scripts manually, everything works, the scripts all start, but they don't start on start time. I assume the problem is with the supervisor. Thank you.

The error:

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

My supervisord.conf file:

[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

I use alpine linux in the container.

Upvotes: 3

Views: 7614

Answers (1)

Garima
Garima

Reputation: 141

There are few problems here

  1. The following statement:

    [supervisord] nodaemon=false

This makes the Supervisord run as daemon and the container needs a main process.

Try changing it to

[supervisord]
nodaemon=true

This configuration makes Supervisord itself run as a foreground process, which will keep the container up and running.

  1. From the logs '520 INFO exited: datagrid (exit status 0; not expected)'

Supervisord is not able to recognise 0 as valid exit code and is exiting the process. Add the following to the conf for all the processes. This will tell Supervisord to try restarting the process only if the exit code is not 0

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

Upvotes: 8

Related Questions