3

I am building a tomcat container in Docker with supervisord. If the default command in the Dockerfile is

CMD supervisord -c /etc/supervisord.conf

and when i dispatch docker stop command, the container exits successfully with the exit code 0.

But instead if i have

CMD ["/run"] 

and in run.sh,

supervisord -c /etc/supervisord.conf

The docker stop command gives me a exit code -1. On viewing the logs, it seems that the supervisord did not receive the SIGTERM indicating the exit request.

2014-10-06 19:48:54,420 CRIT Supervisor running as 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 any HTTP authentication checking
2014-10-06 19:48:54,451 INFO supervisord started with pid 6
2014-10-06 19:48:55,457 INFO spawned: 'tomcat' with pid 9
2014-10-06 19:48:56,503 INFO success: tomcat entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

as opposed to the previous logs where it receives a sigterm and gracefully exits.

2014-10-06 20:02:59,527 CRIT Supervisor running as 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 any HTTP authentication checking
2014-10-06 20:02:59,557 INFO supervisord started with pid 1
2014-10-06 20:03:00,561 INFO spawned: 'tomcat' with pid 9
2014-10-06 20:03:01,602 INFO success: tomcat entered RUNNING state, process has stayed up for > than 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 for tomcat to 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 to your socket file

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
cucucool
  • 3,777
  • 8
  • 48
  • 63

1 Answers1

3

When you run the process via run.sh, signals are only sent to that process. Unless you are

  1. going out of your way to send signals to child processes, e.g. with trap
  2. sending signals to the process group.
  3. doing exec supervisord ... in run.sh

the child process won't get the signals.

seanmcl
  • 9,740
  • 3
  • 39
  • 45