0

I would like to launch two services using docker-compose using the same image passing to the same image two different parameters, with eth and btc values. The jar expects an argument with one of those two values.

The services are demo-quartz-btc and demo-quartz-eth.

When I launch docker-compose, I can see in the log the following messages:

demo-quartz-btc_1 | Error: Unable to access jarfile /opt/app/demo-quartz.jar $CRYPT_TYPE

demo-quartz-eth_1 | Error: Unable to access jarfile /opt/app/demo-quartz.jar $CRYPT_TYPE

This is the link that shows the docker-compose.yml.

This is the link that shows the Dockerfile.

I followed the solution of this link, , but it doesn't work for me. Also I followed the official help, but it does not work.

Docker engine version is 18.09.2, compose version is 1.23.2.

Can someone help me? What do am I doing wrong?

EDIT

I can see in logs that no argument is being applied using docker-compose up. Is there any recommended way to run two services that need another services to run, like zookeeper, kafka, Eureka or others?

EDIT 1

Ok, now I know that I can run a container with the service using a entry-point.sh script file passing the argument to the container. Now, ¿how can I do the same using docker-compose up command?. I need all services/containers running in the same process.

EDIT 2

Do i have to put in script file the necessary docker run -it commands to have everything up and running?

// 31 July 2019 new Dockerfile. I can run this container in isolated mode, 
//without kafka,zookeeper and Eureka server.
// I can pass arguments to Dockerfile running the next commands:
// mvn clean package -DskipTests
// docker build -t aironman/demo-quartz .
// docker run -it aironman/demo-quartz:latest eth
// where eth is the argument.

~/D/demo-quartz> cat Dockerfile
FROM adoptopenjdk/openjdk12:latest
ARG JAR_FILE
ARG CRYPT_TYPE
RUN mkdir /opt/app
COPY target/demo-quartz-0.0.2-SNAPSHOT.jar /opt/app/demo-quartz.jar
COPY entry-point.sh /
RUN chmod +x entry-point.sh
ENTRYPOINT ["/entry-point.sh"]
aironman
  • 837
  • 5
  • 26
  • 55

1 Answers1

0

The solution is to have two Dockerfile files, each with an entry-point.sh file, each with the parameters you need. I realize that I have to adapt to the way Docker/Kubernetes wants you to work and not the other way around.

aironman
  • 837
  • 5
  • 26
  • 55