-
Notifications
You must be signed in to change notification settings - Fork 477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jlink runtime image size (specifically libjvm.so) created from openjdk is huge. Expected it to be much smaller. #217
Comments
For the |
@tianon it is not just for the |
I have the exact same issue, runing the same jlink command on my local machine creates runtime of about 40 mb, the same command in a container creates a runtime image of 350 mb. Have been debuging all that i can, must be something with the image. |
Tried with slim and reguler, same issue |
I've verified and the problem started in OpenJDK 10.0.2 (10.0.1 works as expected, small size). Note: I couldn't reproduce this downloading the OpenJDK builds from http://jdk.java.net, the issue appears to be something with the OpenJDK builds used by the images on this repo. |
For comparison: OpenJDK 11+23 dockerhub image: downloaded from jdk.java.net: |
We use Debian's packages, so this really needs to be filed at
https://bugs.debian.org/src:openjdk-10 (since it's their packages which
have the issue -- there's not really anything we can do to make that binary
smaller).
|
Back reference to the debian ticket: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=905575 |
Yeah, in their 10.0.2 build, doko added * Configure with --with-native-debug-symbols=internal. See http://hg.openjdk.java.net/jdk/jdk11/raw-file/tip/doc/building.html#native-debug-symbols for details of the option. |
As a workaround if you run strip on libjvm.so it cuts the file size from 421M down to only 18M!
|
I've run into this problem as well, but am somewhat confused by the root cause. The
I also tried passing |
As noted in the linked Debian bug, the problem is not the size of the system $ docker run -it --rm -w /tmp openjdk:11-slim bash
root@2b88d78d9a67:/tmp# ls -lh /usr/lib/jvm/java-11-openjdk-amd64/lib/server/libjvm.so
-rw-r--r-- 8 root root 18M Oct 17 07:31 /usr/lib/jvm/java-11-openjdk-amd64/lib/server/libjvm.so
root@2b88d78d9a67:/tmp# ls -lh /usr/lib/jvm/java-11-openjdk-amd64/jmods/java.base.jmod
-rw-r--r-- 8 root root 154M Oct 17 07:31 /usr/lib/jvm/java-11-openjdk-amd64/jmods/java.base.jmod
root@2b88d78d9a67:/tmp# unzip /usr/lib/jvm/java-11-openjdk-amd64/jmods/java.base.jmod
....
root@2b88d78d9a67:/tmp# ls -lh lib/server/
total 421M
-rw-r--r-- 1 root root 1.3K Oct 17 16:52 Xusage.txt
-rw-r--r-- 1 root root 25K Oct 17 16:51 libjsig.so
-rw-r--r-- 1 root root 421M Oct 17 16:51 libjvm.so |
@barchetta as I noted above if you run the command
|
Description
When building a Docker image for a service based on OpenJDK base image, I noticed that the runtime image created is
346Mb
(and specifically the filelibjvm.so
under /lib/security) in size as compared to OracleLinux base image which creates a runtime image of49Mb
. What is the reason for this huge disparity in size?I have tried building from different variants of 10 and 11 base images, but I still see the large runtime size.
Configuration
Docker -
macOS - Sierra (10.12.6)
Dockerfile -
Actual Results
Digging a little deeper, it appears the primary reason for this bloat is
libjvm.so
.Expected Results
Expect a much smaller runtime image. For example if I use Oracle Linux as base image,
Dockerfile -
I get a
49Mb
image size, which is expected.The text was updated successfully, but these errors were encountered: