Home > Software design >  Docker container stop but the .jar app inside still works
Docker container stop but the .jar app inside still works

Time:07-15

I have an OpenLiberty Server which i developed on Eclipse with maven and microprofile framework. It is now just a Java Application as a .jar file. I can execute it with "java -jar name.jar" from the cmd. I created a docker container based on OpenJdk image and this is the text of my Dockerfile:

FROM openjdk:12-oracle
COPY projectname.jar /projectname.jar
CMD ["java", "-jar", "projectname.jar"]

and created the Image with: docker build -t takemealong .

and created the container with: docker run -p 8080:8080 --name TakeMeAlong_Container takemealong

It works fine and i can reach my index.html, but when i stop the Container, the Webserver keep working in the background, even when i stop the entire docker. I can see it in the task manager with the name: "Vmmem" and the index.html still of course reachable.

How can i make it stop, when i stop the docker container?

CodePudding user response:

Stopping container stops also all processes inside. This is the answer on your question. If you have something still running, it must be started from somewhere else (another container or normal system process).

CodePudding user response:

type docker ps and then you will see container id after that type docker kill <container id>or docker rm <container id>

  • Related