I´ve a running hzc-yml configuration in classpath – the generated jar file works fine in a docker context. Now I want to load this yml-file externally. I added this startup-property to my DOCKERFILE:
-Dhazelcast.config=`./hazelcast.yaml`
The whole DOCKERFILE looks like:
FROM openjdk:14 VOLUME /tmp WORKDIR /service RUN mkdir /service/logs COPY jar/hazelcast.yaml hazelcast.yaml COPY jar/log4j.properties log4j.properties COPY jar/hzc-service.jar hzc-service.jar ENTRYPOINT exec java -Dhazelcast.config=`./hazelcast.yaml` -Dhazelcast.logging.type=log4j -Dlog4j.configuration=file:./log4j.properties -Djava.security.egd=file:/dev/./urandom --add-modules java.se --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED $JAVA_OPTS -jar hzc-service.jar
It seems that the service wants to apply the external yml-file, but I always get this error:
hzc-service | /bin/sh: ./hazelcast.yaml: Permission denied
I applied “chmod 777” to the file with no effect.
Thx
Advertisement
Answer
This looks wrong:
-Dhazelcast.config=`./hazelcast.yaml`
Just remove the backticks and put the filename between quotes:
-Dhazelcast.config='./hazelcast.yaml'
With the backtick character, you open a subshell in bash, and try to run the hazelcast.yaml in it (which of course doesn’t make sense).