Image Overview: jdk

Overview: jdk Chainguard Image

Minimalist Wolfi-based Java JDK image using using OpenJDK. Used for compiling Java applications.

Download this Image

The image is available on

docker pull

Java Application Example

This section outlines how you can build a Java application with the Chainguard JDK Image.

Start by creating a sample Java class named

cat > <<EOL
class HelloWolfi
    public static void main(String args[])
        System.out.println("Hello Wolfi users!");

Then create a multistage Dockerfile, adding the Java class you just created:

cat >Dockerfile <<EOL

COPY /home/build/
RUN javac


COPY --from=0 /home/build/HelloWolfi.class /app/
CMD ["HelloWolfi"]

Following that, you can build the image:

docker build -t my-java-app .

Note that this example tags the image with my-java-app. You can now run the image by referencing this tag, as in the following command:

docker run my-java-app
Hello Wolfi users!

Last updated: 2024-04-11 12:38