I have been trying to install tomcat7 on ubuntu docker images with apt-get install tomcat7
.
The installation works fine and starting tomcat from the catalina.sh works as well.
I need to start tomcat from "service tomcat7 start", which instead fails.
Regardless the failure result, if I wget localhost:8080
I can see tomcat answering and if I ps -ef | grep tomcat
I can see the process.
Similarly if I run service tomcat7 status
it says the tomcat is not running even when it is and the PID file does exist.
I have noticed that when I start tomcat from the catalina scripts, the pid file created is called tomcat.pid, but the /etc/init.d/tomcat
script would try to read tomcat7.pid.
However, forcing the name in the script to peek up the right pid file, does not solve the problem.
Has anyone else experienced this?
The ubuntu version of the docker file I am trying is not really relevant, since I have been trying with several.
Anyway the one I am mostly using are 12.10 and 14.04.
Thanks!
I happens have the some situation, it caused by deleting
/var/lib/tomcat7/logs
directory, where I remake the directory, it owned by another user, so thattomcat7
can not restart, and not logs output, I change own, now it works fine.I encountered this. I fixed it (finally) by adding
JAVA_HOME=/usr/lib/jvm/java-8-oracle
to/etc/default/tomcat7
. For some reason it was using thatJAVA_HOME
to actually run the process, but it was using/usr/lib/jvm/default-java
to check if the process was running. This confused it, so it never detected that the process was running.In the docker Ubuntu image I am using (5506de2b643b - 14.04.1 LTS), the start-stop-daemon with the
--test
argument is working incorrectly and reports that tomcat is not running, even when it is.The tomcat7 init.d script starts tomcat because
start-stop-daemon --test
says (correctly) tomcat is not running, but then a little later in the startup process it checks that tomcat started successfully and is running.start-stop-daemon --test
now incorrectly says tomcat is not running, which causes the tomcat7 init.d script to remove the PID file.As a result,
service tomcat7 status
returns false when tomcat is running because the PID file is gone, but it will return false even if the PID file is there with correct PID due to the bug instart-stop-daemon --test
.Here's an example session demonstrating the bug:
Docker does not start up any of the OS services, only the command given in the Dockerfile or explicitly on the command line.
My understanding is that
service
and related commands depend on an init process which does not exist.You should start you tomcat explicitly from the Catalina scripts. You can wrap that with something like supervisord to get the "restart-if-it-crashes" behavior.