Dockerfile not picking up $JAVA_OPTS

4/3/2020

I have a Kubernetes definition as such

{{/* use with indent 2 */}}
{{- define "blah" -}}
 env:
 - name: JAVA_OPTS
   value: "-XX:MaxMetaspaceSize={{ .Values.global.options.maxSS }}
{{- end -}}

And I would like to pass this through to my Docker image via CMD as such

CMD ["sh", "-c", "java $JAVA_OPTS -cp blah.jar:/app/conf/:/app/sec/ abc.App"]

However, the pod crashloops when it comes up and checking the logs on the container, I see the error

Error: Could not find or load main class abc.App

I'm not sure what the issue is.

-- Tee Hammed
cmd
docker
java
java-opts
kubernetes

0 Answers