I want two separate JAR files to run automatically as soon as the docker run mycontainer container is called through the launch command, so when I type docker run mycontainer , they are both called. So far I have a docker file that looks like this:
# base image is java:8 (ubuntu) FROM java:8 # add files to image ADD first.jar . ADD second.jar . # start on run CMD ["/usr/lib/jvm/java-8-openjdk-amd64/bin/java", "-jar", "first.jar"] CMD ["/usr/lib/jvm/java-8-openjdk-amd64/bin/java", "-jar", "second.jar"]
This, however, is just beginning second.jar.
Now both banks are servers in a cycle, so I think that when one of them starts, it just blocks the terminal. If I run the container using run -it mycontainer bash and name them manually, the first one will exit it and I cannot start the other.
Is there a way to open different terminals and switch between them so that each JAR works in its own context? Preferably already in the docker file.
I don't know anything about ubuntu, but I found the xterm command that opens a new terminal, however this will not work after calling the JAR. I am looking for instructions for a docker file, for example, to open a new terminal, execute first.jar, alt-tab in the old terminal and execute second.jar, or at least achieve the same.
Thanks!
buggy source share