This image contains the Java Development Kit (JDK) 25 from the Eclipse Temurin project, which in this case is a compilation of the OpenJDK project. This includes the Java Runtime Environment (JRE) and development tools necessary for building, testing, and running Java applications.
This carefully crafted Docker image delivers a pristine and lightweight installation of JDK 25. It is built upon Sourcemation’s optimized Debian 13 Slim base, ensuring a minimal footprint and enhanced security.
This image can be used to both run and build Java applications, serving as a drop-in replacement for the Temurin JDK 25 image.
To run the base image without any additional configuration, you can use the following:
docker run -it --rm sourcemation/jdk-25
This will start a jshell inside a container with JDK 25 installed and ready to
use.
The following Dockerfile demonstrates how to run a pre-built Java application using the JDK 25 image:
from sourcemation/jdk-25
# Copy your Java application JAR file into the image
COPY your-application.jar /app/your-application.jar
# Set the working directory
WORKDIR /app
# Run the Java application
CMD ["java", "-jar", "your-application.jar"]
You can also run a Java application directly from the command line by mounting the volume:
docker run -it --rm -v /path/to/your/application:/app sourcemation/jdk-25 java -jar /app/your-application.jar
Lastly, to add custom CA certificates, you can mount a volume (or copy it to the image during the Containerfile/Dockerfile build) and set the USE_SYSTEM_CA_CERTS environment variable to 1:
docker run -v /home/dev/mycerts:/certificates/ -e USE\_SYSTEM\_CA\_CERTS=1 sourcemation/jdk-25
FROM sourcemation/jdk-25
# Copy your CA certificates into the image
COPY mycerts /certificates/
# Set the environment variable to use system CA certificates
ENV USE_SYSTEM_CA_CERTS=1
# Set the working directory
WORKDIR /app
# Run the Java application
CMD ["java", "-jar", "your-application.jar"]
To enhance security, it is recommended to run your Java application as a non-root user. To create a new user and run your application as that user, you can use the following dockerfile:
FROM sourcemation/jdk-25
# Create a new user
RUN useradd -m -s /bin/bash myuser
# Copy your Java application JAR file into the image
COPY your-application.jar /app/your-application.jar
# Set the working directory
WORKDIR /app
# Change ownership of the application files
RUN chown -R myuser:myuser /app
# Switch to the new user
USER myuser
# Run the Java application
CMD ["java", "-jar", "your-application.jar"]
This example demonstrates how to compile a Java source file and then run the resulting class file within the container.
Create a Dockerfile:
FROM sourcemation/jdk-25
# Create a directory for the application source
WORKDIR /app
# Copy the Java source file into the container
COPY MyApp.java .
# Compile the Java source file
RUN javac MyApp.java
# Command to run the compiled Java application
CMD ["java", "MyApp"]
Create a simple Java application file named MyApp.java:
public class MyApp {
public static void main(String[] args) {
System.out.println("Hello from JDK 25!");
}
}
Build the Docker image:
docker build -t myjdkapp .
Run the Docker image:
docker run --rm myjdkapp
This will output:
Hello from JDK 25!
Standard encoding is set to en_US.UTF-8, and other locale variables default to en_US. JAVA_VERSION can help you identify the Java version, and JAVA_HOME is set to /opt/java/openjdk.
JAVA_VERSION=jdk-25.0.2+10 # or a newer version depending on the build
JAVA_HOME=/opt/java/openjdk
PATH=$JAVA_HOME/bin:$PATH
# Encoding
LANG='en_US.UTF-8'
LANGUAGE='en_US:en'
LC_ALL='en_US.UTF-8'
This image was created with the intention of being a drop-in replacement for the Temurin JDK 25 image. This image runs as the root user! You should extend it to run your application as a non-root user.
We welcome your contributions! If you have new feature requests, want to report a bug, or wish to submit a pull request with your code or an image request, you can do so via the Sourcemation GitHub repository for this image.
Sourcemation offers a range of open-source projects and Docker images with extensive risk assessment of open-source software. We are committed to providing high-quality images. Comprehensive risk analysis reports for selected images are available on the Sourcemation platform.
The OpenJDK project is licensed under the GNU General Public License, version 2, with the Classpath Exception.
Content type
Image
Digest
sha256:ce39bb0c4…
Size
184.1 MB
Last updated
13 days ago
docker pull sourcemation/jdk-25