I have a Java application that is running in the container, and I have removed the core jar file from the container, but still the application in the container is UP and RUNNING, I don't understand how ?
If a Java application is running on our local system, then you can't remove or modify the jar files that are currently used by the application. Even if you try to delete the jar file, you will get the prompt message "The action can't be completed because the file is open in Java Platform Architecture".
How are the host OS processes used in the Docker container? Can someone please explain how this works?
To recreate the scenario: Please download the Tomcat image from the docker hub. Create and run the container using the command (docker run -it --rm -p 8888:8080 tomcat), Now, open the webpage on localhost:8888, and you will see the webpage as HTTP Status 404: Not Found (that's OK - this is expected). Now, the container is UP and RUNNING.
Go inside the container and try to delete the jar files in the lib directory (full path: /usr/local/tomcat/lib) using the command (rm jar-file-name). and please check the web page again, now you will see the same page, where the application is running properly, even after the jar files are removed.