0

In order to shutdown a Tomcat docker container gracefully, is it possible to issue a remote SHUTDOWN command? rather than setting up docker to catch the kill request, and shutting down gracefully.

Default server.xml:

<Server port="8005" shutdown="SHUTDOWN">
0

According to this page: http://www.techpaste.com/2012/01/server-xml-container-configurations-tomcat-7-explained/

There is an 'address' parameter:

This attribute specifies the TCP/IP address on which this server listens for the shutdown command. The default value is localhost, which means that the server can be shut down from the same machine where it is installed (i.e., remote shutdown is disabled).

Setting the address parameter to 0.0.0.0 will enable the container to listen on the hosts IP address.

Server.xml

<Server port="8005" address="0.0.0.0" shutdown="SHUTDOWN">

Map the shutdown port (in this case 8005) to a host port.

You can change the shutdown parameter to a random string, or use appropriate firewall/security groups to manage securing the port.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.