Image Overview: jre

Overview: jre Chainguard Image

WARNING

This image will switch from including a full complement of JDK binaries to a minimally required set in a forthcoming release. The work is being tracked in this GitHub issue.

If you rely on any binaries or libraries that are included in this image beyond the core JRE runtime, consider switching to the JDK Image.

Minimalist Wolfi-based Java JRE image using OpenJDK. Used for running Java applications.

Get It!

The image is available on cgr.dev:

docker pull cgr.dev/chainguard/jre:latest

Use it

Create a simple Java class

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

Next create a multistage Dockerfile and add the Java class

cat >Dockerfile <<EOL
FROM cgr.dev/chainguard/jdk

COPY HelloWolfi.java /home/build/
RUN javac HelloWolfi.java

FROM cgr.dev/chainguard/jre

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

Build the image

docker build -t my-simple-java-app .

Run the image

docker run my-simple-java-app