Stop tomcat in docker container
Daniel-S-Python opened this issue · 2 comments
Hello, I'm new to tomcat and I don't know where I can find this info. Maybe somebody here can help:
How can I stop the tomcat service inside the docker container when I have an interactive shell opend? I must stop the service to update a webapp.
Thank you for any help.
BR
Daniel
The usual method for containers is that they don't have a process supervisor like init
or systemd
which would otherwise take the place of PID 1.
$ docker exec -it tomcat bash
root@ef341a450431:/usr/local/tomcat# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 29.3 4.0 2585620 82600 ? Ssl 19:41 0:02 /usr/local/openjdk-11/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/l
root 40 1.0 0.1 5752 3612 pts/0 Ss 19:41 0:00 bash
root 46 0.0 0.1 9392 3100 pts/0 R+ 19:41 0:00 ps aux
Because tomcat is PID 1 it can't be restarted since that requires the process to exit, and PID 1 is special in that regard that when it exits so does the container.
(In the future, these sorts of questions/requests would be more appropriately posted to a dedicated support forum, such as the Docker Community Forums, the Docker Community Slack, or Stack Overflow. 👍)