Accessing Host Java from Docker container

前端 未结 2 888
-上瘾入骨i
-上瘾入骨i 2021-01-27 07:36

I have Java installed in my docker host. Now I want that to be able to my docker containers. I don\'t want to install again on the containers. Do we have any workaround for that

2条回答
  •  悲哀的现实
    2021-01-27 08:19

    I guess what you looking for is GraalVM which is built and managed by Oracle. They have community and enterprise editions.

    Take a look at this blog -> https://blog.softwaremill.com/small-fast-docker-images-using-graalvms-native-image-99c0bc92e70b (walks through on how to create small docker containers for Java application using graalvm.)

    Bundling JDK or JRE within your app container can soon make your containers extremely bloated. Using GraalVM is a good way to tackle this problem.

    Alternatively, you can have the JDK in a different container and mount the JAVA_HOME path as a volume in your app container(s). So you have one JDK container being shared between multiple app containers.

提交回复
热议问题