Dynamically set JAVA_HOME of docker container

前端 未结 4 1368
粉色の甜心
粉色の甜心 2020-12-21 10:24

My docker container requires JAVA_HOME to be set. I have added it to the Dockerfile as below

ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/jre
         


        
4条回答
  •  暖寄归人
    2020-12-21 10:26

    The image built from a Dockerfile is forever static. Its Java location will never change unless rebuilt.

    When the image is started as a container, however, anything can happen. If there's any scripts that will edit the Java location during runtime, then this script is probably also where JAVA_HOME should be updated.

    If you mean that you want to dynamically build your image using an arbitrary base image with differing java location then this should probably be handled by a build script.

提交回复
热议问题