Docker stop exit code -1 if the default CMD is a shell script -



Docker stop exit code -1 if the default CMD is a shell script -

i building tomcat container in docker supervisord. if default command in dockerfile

cmd supervisord -c /etc/supervisord.conf

and when dispatch docker stop command, container exits exit code 0.

but instead if have

cmd ["/run"]

and in run.sh,

supervisord -c /etc/supervisord.conf

the docker stop command gives me exit code -1. on viewing logs, seems supervisord did not receive sigterm indicating exit request.

2014-10-06 19:48:54,420 crit supervisor running root (no user in config file) 2014-10-06 19:48:54,450 info rpc interface 'supervisor' initialized 2014-10-06 19:48:54,451 crit server 'unix_http_server' running without http authentication checking 2014-10-06 19:48:54,451 info supervisord started pid 6 2014-10-06 19:48:55,457 info spawned: 'tomcat' pid 9 2014-10-06 19:48:56,503 info success: tomcat entered running state, process has stayed > 1 seconds (startsecs)

as opposed previous logs receives sigterm , gracefully exits.

2014-10-06 20:02:59,527 crit supervisor running root (no user in config file) 2014-10-06 20:02:59,556 info rpc interface 'supervisor' initialized 2014-10-06 20:02:59,556 crit server 'unix_http_server' running without http authentication checking 2014-10-06 20:02:59,557 info supervisord started pid 1 2014-10-06 20:03:00,561 info spawned: 'tomcat' pid 9 2014-10-06 20:03:01,602 info success: tomcat entered running state, process has stayed > 1 seconds (startsecs) 2014-10-06 20:05:11,690 warn received sigterm indicating exit request 2014-10-06 20:05:11,690 info waiting tomcat die 2014-10-06 20:05:12,450 info stopped: tomcat (exit status 143)

any help appreciated.

thanks, karthik

update:

supervisord.conf file

[supervisord] nodaemon=true logfile=/var/log/supervisor/supervisord.log [program:mysql] command=/usr/bin/pidproxy /var/run/mysqld/mysqld.pid /usr/bin/mysqld_safe --pid-file=/var/run/mysqld/mysqld.pid stdout_logfile=/tmp/mysql.log stderr_logfile=/tmp/mysql_err.log [supervisorctl] serverurl=unix:///tmp/supervisor.sock [unix_http_server] file=/tmp/supervisor.sock ; path socket file [rpcinterface:supervisor] supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

when run process via run.sh, signals sent process. unless

going out of way send signals kid processes, e.g. trap sending signals process group. doing exec supervisord ... in run.sh

the kid process won't signals.

shell docker supervisor sigterm

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -