New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't use docker stop with tomcat image. Exit code 143 is returned. Exit code 0 was expected #57
Comments
Did you check the logs from the container to see why it's failing? ( |
Hi,
I think the problem is executing catalina.sh directly. For starting the docker image the command You can reproduce this by hand.
The tomcat is now running. Now I enter the container directly in a second shell and kill the tomcat process with SIGTERM like docker does.
In the first shell the tomcat is stopping. I can ask for the exit code with
So back to the Possible solutions:
|
Arg, I see -- I've been researching a little, and it seems like there might not actually be a nice way for Tomcat upstream to fix this issue. http://stackoverflow.com/a/4192488/433558: exit code 143 corresponds to http://stackoverflow.com/a/2541618/433558: Java applications can respond to the shutdown that's initiated by 😭 |
In my opinion this is not an issue, everything works as described docker stop does exactly as the documentation states:
From the docker ps -a you are informed that indeed SIGTERM (143) has resulted in stopping the tomcat container. Further notice: It may also have been a SIGKILL (137) if tomcat would have used more time then the grace period (default: 10 seconds) to shut down. In the description of the run command with regard to the restart-policies it is stated that
So when you give the stop command it will NOT be restarted. What could be wrong is that giving the SIGTERM internally (without docker stop) one would expect the container to be restarted in this setup. But that may depend on the docker implementation... I further tested the case when you send a different signal (e.g. kill -1 1). In that case the container is restarted as i would expect it to... @cpauls can you describe what you wish to accomplish? Note that i have a setup usig systemd (on CoreOS) in which i specified in the unit file to restart the tomcat container in this case (Restart=on-success and SuccessExitStatus=143). But that may not be an option in your case. |
Closing, given that this appears either resolved or working appropriately. 👍 |
Hi,
I played around with the docker container using the docker commands docker start/stop/pause... I'd like to use the docker restart policy with the option
on-failure:
The tomcat docker container does not stops in the expected way. I expected exit code 0 - but the container stops with exit code 143.
Possible solution:
trap
as described in trapping-signals-in-docker-containers or in gracefully-stopping-docker-containers/What do you think about this? Could this be a working solution?
Regards
@cpauls
The text was updated successfully, but these errors were encountered: