containers icon indicating copy to clipboard operation
containers copied to clipboard

Remove src.zip from container images

Open gdams opened this issue 2 years ago • 1 comments

See https://github.com/docker-library/openjdk/issues/282 for context.

The src.zip file is ~50MB and there is no need to include it in the temurin images. This seems like a simple way to reduce the overall image size. I will bring this to the PMC call and report back with the outcome.

gdams avatar Aug 24 '22 15:08 gdams

My 2p: I'd say remove it. I think it's very unlikely that any current or future users of these containers are relying upon it. On the other hand the majority of image users have an interest in small container images.

There's prior art: the Docker Hub containers removed it; most distro packaging removes it or sequesters it into a separate binary package so it is not installed by default (Debian/Ubuntu openjdk-?-source; Fedora/Red Hat java-17-openjdk-src)

I think the reason it is distributed with OpenJDK builds is to enable application developers to step through the JDK classes when running their application in a debugger. I think more than just the src.zip would be needed to enable this kind of debugging within the container. For example the debug symbols. [ having said that, I'd expect the openjdk native binaries and libraries within these containers to be stripped, and they don't appear to be? ] To support this kind of workflow, I think an image consumer would need to assemble as custom "debug" image anyway, and in doing so they could omit the stage removing the src.zip.

jmtd avatar Sep 05 '22 08:09 jmtd

Do we have any updates from PMC?

zdtsw avatar Nov 12 '22 14:11 zdtsw

close this issue, the code has been merged to "master" branch, and will be stated in 2023 Jan release note with updates.

zdtsw avatar Jan 07 '23 10:01 zdtsw

The comments in https://github.com/docker-library/openjdk/issues/282 mention that the src.zip is in the lib directory. #273 removes (or tries to) src.zip in $JAVA_HOME. I noticed there is still lib/src.zip in current images:

$ docker run --rm --entrypoint sh eclipse-temurin:20-alpine -c 'find / -name src.zip -xdev'
Unable to find image 'eclipse-temurin:20-alpine' locally
20-alpine: Pulling from library/eclipse-temurin
8a49fdb3b6a5: Already exists
fdde4a302e0d: Already exists
d186be75a39a: Pull complete
4e526c10d697: Pull complete
Digest: sha256:caaf2247655613ab70bac6a5b927d85a6df223c8697c73c18cba804f297048d3
Status: Downloaded newer image for eclipse-temurin:20-alpine
/opt/java/openjdk/lib/src.zip

So to me it looks like the line rm -f /tmp/openjdk.tar.gz ${JAVA_HOME}/src.zip; should read rm -f /tmp/openjdk.tar.gz ${JAVA_HOME}/lib/src.zip;

maffe avatar May 26 '23 13:05 maffe

The comments in docker-library/openjdk#282 mention that the src.zip is in the lib directory. #273 removes (or tries to) src.zip in $JAVA_HOME. I noticed there is still lib/src.zip in current images:

$ docker run --rm --entrypoint sh eclipse-temurin:20-alpine -c 'find / -name src.zip -xdev'
Unable to find image 'eclipse-temurin:20-alpine' locally
20-alpine: Pulling from library/eclipse-temurin
8a49fdb3b6a5: Already exists
fdde4a302e0d: Already exists
d186be75a39a: Pull complete
4e526c10d697: Pull complete
Digest: sha256:caaf2247655613ab70bac6a5b927d85a6df223c8697c73c18cba804f297048d3
Status: Downloaded newer image for eclipse-temurin:20-alpine
/opt/java/openjdk/lib/src.zip

So to me it looks like the line rm -f /tmp/openjdk.tar.gz ${JAVA_HOME}/src.zip; should read rm -f /tmp/openjdk.tar.gz ${JAVA_HOME}/lib/src.zip;

You are right! I can confirm the original implementation is incorrect. Not sure why on earth I set ${JAVA_HOME} but not ${JAVA_HOME}/lib

zdtsw avatar May 26 '23 13:05 zdtsw

My CI build actually relied on the src.zip being present :(. Are there any flavors of the image where the src.zip is still present?

Elewyth avatar Jul 26 '23 19:07 Elewyth

I'm afraid not sorry. However, you can add your own src.zip from the tagged release https://github.com/adoptium/jdk17u/releases/tag/jdk-17.0.8%2B7

karianna avatar Jul 27 '23 04:07 karianna