![]() Waiting for some further Spring Boot developers recommendations/guides which Java modules to include and when, as same as removing some redundant dependencies, like sktop, which seems to be used only for PropertyEditorSupport ![]() I found them "manually" running the application and fixing ClassNotFoundException. there are 5 java modules included to the minimal JRE example ( java.base,java.sql,java.naming,sktop,java.management,java.instrument).# Second stage, add only our minimal "JRE" distr and our appĬOPY -from=packager "$JAVA_HOME" "$JAVA_HOME"ĬOPY "build/libs/spring-boot-demo.jar" "/app.jar" # java.instrument - java/lang/instrument/IllegalClassFormatException # java.management - javax/management/MBeanServer # sktop - java/beans/PropertyEditorSupport # java.naming - javax/naming/NamingException Java.base,java.sql,java.naming,sktop,java.management,java.instrument \ ( actualize JDK VERSION, URL and HASH value): # First stage: JDK 11 with modules required for Spring BootĮNV JDK_URL="$/:" & \ So, final Dockerfile looks smth like this copy compiled minimal Java distribution from stage 1 to the new image.compile Java minimal distribution for your project (aka JRE) using jlink tool.download and install Oracle OpenJDK archive on the first Docker build stage. ![]() use debian:stretch-slim (latest stable) base image.Jedi path if we want to use official Oracle OpenJDK distribution on stable slim Linux version ( Debian 9 "Stretch" for now): Taking as an example of simple spring boot application (with only one REST endpoint) so far i was able to figure out the following solutions (considering application jar is located at build/libs/spring-boot-demo.jar before Docker build: What are optimized or recommended ways to build and deliver Java 11 applications as docker images? Expected it to be much smaller.Īs a result of these issues even slim Oracle Java 11 base images are quite heavy and considered to be unstable: jlink runtime image size (specifically libjvm.so) created from openjdk is huge.In the same time current stable Debian versions still doesn't have Java 11 packages ( Ubuntu has Java 10 installed under openjdk-11 packages), that's why unstable sid versions are used for base docker imagesĬurrently available Oracle openjdk-11 images build unstripped libjvm.so module, which has hundreds megabyte and must be stripped separately:.Oracle OpenJDK 11 doesn't support Linux Alpine, so lightweight images can't be easily created JRE is not distributed as a separate "package". Inspired by question Why is the Java 11 base Docker image so large? (openjdk:11-jre-slim) I found that this topic in Java world is still not settled.Īs for there are common issues/pitfalls (discussed in the ticket above):
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |