我正在用supervisord在Docker中構建一個tomcat容器。如果Dockerfile默認命令是如果默認CMD是shell腳本,則Docker停止退出代碼
CMD supervisord -c /etc/supervisord.conf
,當我派遣碼頭工人停止命令,容器和退出代碼成功退出0
但是相反,如果我有
CMD ["/run"]
和在run.sh中,
supervisord -c /etc/supervisord.conf
碼頭停止命令給我一個退出碼-1。在查看日誌時,似乎supervisord沒有收到指示退出請求的SIGTERM。
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)
與之前收到sigterm並正常退出的日誌相反。
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)
任何幫助表示讚賞。
感謝, KARTHIK
UPDATE:
supervisord.conf文件
[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
cat你顯示你的supervisord.conf文件的內容嗎? – Thomasleveil 2014-10-06 19:47:24
@Thomasleveil我已經更新了supervisord文件的問題 – KarthikJ 2014-10-23 21:37:32