Why java app docker image based on eclipse-temurin JRE takes 335Mb?

3k views Asked by At

I'm using temurin 17-jre-jammy docker image as a base and it should take ~90Mb of space.

enter image description here

My app currently takes 74Mb so resulting image must be around 164Mb. But it is 335Mb.

When I'm checking layers on Docker Desktop it says that 17-jre-jammy takes ~190Mb which corresponds with the 17 JDK enter image description here

enter image description here

Why JRE layer takes 190Mb instead of 47?) How to fix that?

I tried to find sizes of layers for the 17-jre and on the docker hub it is correct: Image hierarchy eclipse-temurin:17-jre-jammy

1

There are 1 answers

0
Sneg On BEST ANSWER

I've got the source of confusion.

JDK and JRE size on the eclipse temurin site specifies the size of compressed files. After unarchiving it will take more place.

enter image description here

Same thing relates to docker 17-jre-jammy image - 90Mb it is compressed size of the image (it is mentioned just above the size). And after image downloading docker always performs extracting.

So I was referring to compressed size of docker and JDK/JRE while thinking it should be final size.