简体   繁体   中英

Passing runtime parameter to JAR in DockerFile not running

Dockerfile:

FROM anapsix/alpine-java
ADD abc-server-application.jar abc-server-application.jar
EXPOSE 9199

ENTRYPOINT ["java","-Dkafka_delay_time=20","-DlogsInclude=docker-logback.xml","-jar","abc-server-application.jar"]

In /home/user/abc - I have placed the JAR and the Dockerfile and docker-logback.xml file

Build Image:

[root@CP9909abc#]docker build -t abc-server-application:v1.0 .

Run:

8090 is the port configured in application.yml

[root@CP9909abc#]docker run -p 9199:8090 abc-server-application:v1.0 -it /bin/bash &

Now, application is not running. It gives message like -

ch.qos.logback.core.joran.util.ConfigurationWatchListUtil@277050dc - Adding [file:/docker-logback.xml] to configuration watch list. 12:36:51,898 |-WARN in ch.qos.logback.core.joran.action.IncludeAction - Failed to open [file:/docker-logback.xml] 12:36:51,898 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.

In entrypoint, I tried giving absolute path/relative path for docker-logback.xml but it's not working. Any Suggestions on how should I pass the log back file to JAR in Docker?

I don't see the docker-logback.xml getting copied using the Dockerfile also there is no volume mount. Copy it using below statement & then try to run the image -

FROM anapsix/alpine-java
ADD abc-server-application.jar abc-server-application.jar
COPY docker-logback.xml ./
EXPOSE 9199
ENTRYPOINT ["java","-Dkafka_delay_time=20","-DlogsInclude=docker-logback.xml","-jar","abc-server-application.jar"]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM