I'm running an Application in tomcat. It generate some application's temp files during the process. And when we shutdown the tomcat using shutdown.sh
or stop tomcat from IntelliJ then temp files will be converted to csv. This is inbuilt feature of my Application.
Now when I run the same Application in Docker, then temp is not converting to csv format as I expect it to.
I can see ENTERYPOINT
in Docker configuration file that indicates the startup script for the docker. I don't know how docker stop
internally works and what it trigger when we execute docker stop <container Name>
, or where I should define the script for docker stop.
I also tried docker stop -t 10 <container Name>
, with the thought in my mind that it might be tomcat, taking time to shutdown hence docker might be killing the tomcat process. So I tried docker stop
with 10 second time also. But no luck.
I think docker is killing the tomcat when I execute docker stop
Any guidance will be appreciated.
CodePudding user response:
First check this reference for process with pid 1.
Step to perform in your system.
Step 1 :- in entrypoint check your script file.
Step 2 :- update your script line entry.sh, find some line where you're starting your tomcat.
Step 3 :- for start tomcat use "exec sh catalina.sh run".
Step 4 :- check your ps with "docker exec ps -ef" it must be run on pid 1
Step 5 :- rebuild docker image.
Step 6 :- docker stop will send shutdown signal to tomcat and works.
For observe logs use docker logs -f <container_name>