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
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.