Skip to content

[SPARK-47635][K8S] Use Java 21 instead of 21-jre image in K8s Dockerfile - #45761

Closed
dongjoon-hyun wants to merge 1 commit into
apache:masterfrom
dongjoon-hyun:SPARK-47635
Closed

[SPARK-47635][K8S] Use Java 21 instead of 21-jre image in K8s Dockerfile#45761
dongjoon-hyun wants to merge 1 commit into
apache:masterfrom
dongjoon-hyun:SPARK-47635

Conversation

@dongjoon-hyun

@dongjoon-hyundongjoon-hyun commented Mar 28, 2024

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

This PR aims to use Java 21 instead of 21-jre in K8s Dockerfile .

Why are the changes needed?

Since Apache Spark 3.5.0, SPARK-44153 starts to use jmap like the following.

valjmap=System.getProperty("java.home") +"/bin/jmap"

$ docker run -it --rm azul/zulu-openjdk:21-jre jmap
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "jmap": executable file not found in $PATH: unknown.
$ docker run -it --rm azul/zulu-openjdk:21 jmap | head -n2
Usage:
jmap -clstats <pid>

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Pass the CIs and manual review.

Was this patch authored or co-authored using generative AI tooling?

No.

@dongjoon-hyun

Copy link
Copy Markdown
MemberAuthor

Hi, @viirya .

Could you review this bug fix for Apache Spark 3.5.0 and 3.5.1?

@dongjoon-hyundongjoon-hyun changed the title [SPARK-47635][K8S] Use Java 21 instead of 21-jre in K8s Dockerfile[SPARK-47635][K8S] Use Java 21 instead of 21-jre image in K8s DockerfileMar 28, 2024
@dongjoon-hyun

Copy link
Copy Markdown
MemberAuthor

Thank you, @viirya !

@dongjoon-hyun

Copy link
Copy Markdown
MemberAuthor

Merged to master for Apache Spark 4.0.0.

@dongjoon-hyun
dongjoon-hyun deleted the SPARK-47635 branch March 28, 2024 23:33
HyukjinKwon pushed a commit that referenced this pull request Aug 6, 2024
### What changes were proposed in this pull request?
This PR aims to fix `docker-image-tool.sh` to be up-to-date.
### Why are the changes needed?
Apache Spark 4 dropped Java 11 support. So, we should fix the following.
- #43005
```
- - Build and push Java11-based image with tag "v3.4.0" to docker.io/myrepo
+ - Build and push Java17-based image with tag "v4.0.0" to docker.io/myrepo
```
Apache Spark 4 requires JDK instead of JRE. So, we should fix the following.
- #45761
```
- $0 -r docker.io/myrepo -t v3.4.0 -b java_image_tag=11-jre build
+ $0 -r docker.io/myrepo -t v4.0.0 -b java_image_tag=17 build
```
Lastly, `3.4.0` is too old because it's released on April 13, 2023. We had better use v4.0.0.
```
- $0 -r docker.io/myrepo -t v3.4.0 -p kubernetes/dockerfiles/spark/bindings/python/Dockerfile build
+ $0 -r docker.io/myrepo -t v4.0.0 -p kubernetes/dockerfiles/spark/bindings/python/Dockerfile build
```
### Does this PR introduce _any_ user-facing change?
No functional change because this is a usage message.
### How was this patch tested?
Manual review.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes#47618 from dongjoon-hyun/SPARK-49117.
Authored-by: Dongjoon Hyun <dhyun@apple.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
dongjoon-hyun added a commit to apache/spark-docker that referenced this pull request Sep 18, 2024
### What changes were proposed in this pull request?
This PR aims to use JDK for Spark 3.5+ Docker image. Apache Spark Dockerfile are updated already.
- apache/spark#45762
- apache/spark#45761
### Why are the changes needed?
Since Apache Spark 3.5.0, SPARK-44153 starts to use `jmap` like the following.
- apache/spark#41709https://github.com/apache/spark/blob/c832e2ac1d04668c77493577662c639785808657/core/src/main/scala/org/apache/spark/util/Utils.scala#L2030
### Does this PR introduce _any_ user-facing change?
Yes, the user can use `Heap Histogram` feature.
### How was this patch tested?
Pass the CIs.
Closes#66 from dongjoon-hyun/SPARK-49701.
Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
dongjoon-hyun added a commit that referenced this pull request Mar 21, 2026
…kerfile
### What changes were proposed in this pull request?
This PR changes the default Java base image tag from `21` (full JDK) to `21-jre` (JRE only) in the Spark Kubernetes Dockerfile for Apache Spark 4.2.0.
### Why are the changes needed?
Since Apache Spark 3.5, SPARK-44153 starts to use `jmap` for UI.
- #41709
Since Apache Spark 4.0, we used `21` by default.
- #45761
Since Apache Spark 4.2, we can use `21-jre` back by default because we removed `jmap` dependency.
- #54919
The JRE image is significantly smaller than the full JDK image since it excludes development tools (compiler, debugger, etc.) that are not needed at runtime. This reduces the Spark container image size for Kubernetes deployments.
```
$ docker images
IMAGE ID DISK USAGE CONTENT SIZE EXTRA
azul/zulu-openjdk:21 4cfeb0cae1b1 651MB 203MB
azul/zulu-openjdk:21-jre 27894d1c0e9d 461MB 114MB
```
### Does this PR introduce _any_ user-facing change?
No behavior change. In addition, users who need the full JDK can still override via `--build-arg java_image_tag=21`.
### How was this patch tested?
Pass the CIs and manual review of the Dockerfile change.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (claude-opus-4-6)
Closes#54940 from dongjoon-hyun/SPARK-56128.
Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
terana pushed a commit to terana/spark that referenced this pull request Mar 23, 2026
…kerfile
### What changes were proposed in this pull request?
This PR changes the default Java base image tag from `21` (full JDK) to `21-jre` (JRE only) in the Spark Kubernetes Dockerfile for Apache Spark 4.2.0.
### Why are the changes needed?
Since Apache Spark 3.5, SPARK-44153 starts to use `jmap` for UI.
- apache#41709
Since Apache Spark 4.0, we used `21` by default.
- apache#45761
Since Apache Spark 4.2, we can use `21-jre` back by default because we removed `jmap` dependency.
- apache#54919
The JRE image is significantly smaller than the full JDK image since it excludes development tools (compiler, debugger, etc.) that are not needed at runtime. This reduces the Spark container image size for Kubernetes deployments.
```
$ docker images
IMAGE ID DISK USAGE CONTENT SIZE EXTRA
azul/zulu-openjdk:21 4cfeb0cae1b1 651MB 203MB
azul/zulu-openjdk:21-jre 27894d1c0e9d 461MB 114MB
```
### Does this PR introduce _any_ user-facing change?
No behavior change. In addition, users who need the full JDK can still override via `--build-arg java_image_tag=21`.
### How was this patch tested?
Pass the CIs and manual review of the Dockerfile change.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (claude-opus-4-6)
Closesapache#54940 from dongjoon-hyun/SPARK-56128.
Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@dongjoon-hyun@viirya