Even though docker is meant to run a single service in one container, for some reason I want to run two services that communicate with each other in one container. I have two spring boot services: Demo and Demo2
To do that, I made a shell script to run two jars of two applications and then pass that script to Dockerfile's Entrypoint.
shell script (invoke.sh)
#!/bin/bash
java -jar app.jar && java -jar app2.jar
Dockerfile
FROM openjdk:8-jdk-alpine
VOLUME /tmp
COPY demo/demo/target/demo-0.0.1-SNAPSHOT.jar app.jar
COPY demo2/demo2/target/demo2-0.0.1-SNAPSHOT.jar app2.jar
COPY invoke.sh invoke.sh
ENTRYPOINT ["sh","/invoke.sh"]
Image creation is successful. But when I run that image it only starts the first spring boot application.
Why it doesn't start the app2.jar? What shoud I do to start both applications? Any help to solve this issue would be highly appriciated.