Skip to content
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

Why is debian apt install so much larger than the JDK release binary? #940

Closed
dtanner opened this issue Jun 20, 2024 · 2 comments
Closed

Comments

@dtanner
Copy link

dtanner commented Jun 20, 2024

Inspecting eclipse-temurin:17.0.11_9-jdk-jammy for example, the size of the layer that installs the JDK is 281 MB. This technique downloads the release binary.

I'm switching my FROM to be a different base image, so I originally wrote my Dockerfile to use apt to install the JDK, using the debian instructions, like this:

RUN wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor | tee /etc/apt/trusted.gpg.d/adoptium.gpg > /dev/null && \
    chmod o+r /etc/apt/trusted.gpg.d/adoptium.gpg && \
    echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list && \
    apt-get update && \
    apt-get install -y temurin-${TEMURIN_TAG} && \
    apt-get clean

The issue is that this style adds 353 MB of space (an extra 72 MB). Is there a better way to use apt to install the JDK that will result in a layer size closer to the binary download style? Or would I need to switch to downloading the binary like the eclipse-temurin image does?

Thanks for any advice.

@sxa
Copy link
Member

sxa commented Jun 24, 2024

Good question. I don't think anyone on the team is investigated that but I expect it's pulling in a larger set of prerequisite packages form the system package repositories than our images have. For example you're probably getting at least the X11 (GUI) packages that are typically not required in a container (and aren't in our images). Related: #917

Also bear in mind that depending on your use case, if space is an issue then using a jlinked runtime to reduce the size further may also be appropriate (but again that would not be for use with our dpkg install).

@sxa
Copy link
Member

sxa commented Aug 13, 2024

Closing based on the explanation above.

@sxa sxa closed this as completed Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants