How do I run a jar in a docker container and not be exited?
I use a mirror on the hub.docker "serperga / centos-java-7-oracle-image" to start a container, and intend to use him to run a jar, the jar is maven packaged out can be run directly. Has been running under windows, Linux can also run.
Use the following commands:
[root@localhost ~]# docker run -i -t --privileged=true -v /root/myjar/redis.jar:/root/redis.jar --name redis_2 docker.io/serperga/centos-java-7-oracle-image java -jar /root/redis.jar
After the start, there will be a lot of log printing on my screen.
- Webpack2 started
- Socket client connection problem?
- Docker installs ZeroMQ
- Chapter 5 Deploying Java EE 7 Applications
- Docker running tomcat, the default is IP: port access, how to become a direct use of domain names
- Remote docker how to manage intellij idea
At this point you can see the container is started, and the service is running normally
At this time whether I was ctrl + c or ctrl + z out of the shell (Figure 1) shown the shell
The container will exit
So how can i let a container run my jar and keep the jar not going to be exited and the container will not be closed?