Public | Automated Build

Last pushed: 2 years ago
Short Description
Oracle Java SE Embedded full and profiles (compact1, compact2, compact3)
Full Description

docker-ejre

This project create docker images for Oracle Java SE Embedded 8u51.

There is an image for each "compact profile" (see JEP 161 ) : compact1, compact2, compact3 and jre (=full SE)

These JREs are very small because they're made for embedded system.

Supported tags and respective Dockerfile links

There are a tagged image for each "compact profile" :

Details

What are these?

tl;dr : Busybox + libc 64bit + libc 32 bits + Embedded JRE = Small Java Container

All image are based on Busybox with 32 bits (and 64 bits) libs (see docker-busybox-jvm and docker-busybox-lib32 ).

The overhead on top of a JRE is around 8 MB.

JVM aren't statically linked so you can still navigate inside container or use some shell scripting.

JRE are always installed in /usr/lib/jvm and link to /usr/lib/jvm/jre.

Sample :

/ # ls -l /usr/lib/jvm/
total 4
drwxr-xr-x    4 root     root          4096 Jul 15 23:03 ejdk1.8.0_51-compact1
lrwxrwxrwx    1 root     root            34 Jul 15 23:03 jre -> /usr/lib/jvm/ejdk1.8.0_51-compact1

Size matters

The biggest advantage of these image are their size : only 40 MB for a "compact" edition and 80 MB for a full SE JRE.

It's 6 or 12 times smaller than the official java image (cause it's headfull and based on a full Debian) !

Here is a list of some java image.

REPOSITORY                  TAG          IMAGE ID        CREATED         VIRTUAL SIZE
ofayau/j2me                 latest       f56c31b1cc20    26 hours ago    21.73 MB
ofayau/ejre                 8-compact1   824a6f1a0ade    4 minutes ago   39.31 MB
ofayau/ejre                 8-compact2   9da39771057a    4 minutes ago   44.85 MB
ofayau/ejre                 8-compact3   a9fbe6b90034    4 minutes ago   48.79 MB
ofayau/ejre                 8-jre        d5ed29a4bf44    4 minutes ago   80.66 MB
ofayau/openjdk              8-compact1   f258bd30ec46    5 days ago      47.08 MB
ofayau/openjdk              8-compact2   dc125eeac09b    5 days ago      59.82 MB
ofayau/openjdk              8-compact3   b10fc16f53ea    5 days ago      66.38 MB
ofayau/openjdk              8-jre        fded935a77ed    5 days ago      115.1 MB
frolvlad/alpine-oraclejdk8  latest       8e87306ea37d    7 weeks ago     170.4 MB
jeanblanchard/busybox-java  8            f9b532dbdd9f    3 months ago    162 MB
java                        8-jre        b0f21df5333b    5 months ago    478.7 MB

Drawback

  • truncated JRE : "compact profiles" doesn't contain every java package. Only 8-jre is considered as full SE (but still headless).

  • 32 bits only : you can't run 64 bits code.

  • JRE, not JDK : hence there is no compiler (javac) included, only runtime executor (java). You have to compile somewhere else (i.e. a standard jdk 8).

License

Oracle and Java are registered trademarks of Oracle and/or its affiliates.

The Java softwares (including JDK or JRE) belong to Oracle and this redistribution is not for commercial use.

The ejdk directory is the unzipped version of ejdk-8u51-linux-i586.tar.gz available (with login) on Oracle

Installation & Usage

Download or update tagged images :

docker pull ofayau/ejre:8-compact1
docker pull ofayau/ejre:8-compact2
docker pull ofayau/ejre:8-compact3
docker pull ofayau/ejre:8-jre
docker pull ofayau/ejre:latest

Showing java version of every image :

# docker run --rm -it ofayau/ejre:8-compact1 java -version
java version "1.8.0_51"
Java(TM) SE Embedded Runtime Environment (build 1.8.0_51-b07, profile compact1, headless)
Java HotSpot(TM) Embedded Server VM (build 25.51-b07, mixed mode)

# docker run --rm -it ofayau/ejre:8-compact2 java -version
java version "1.8.0_51"
Java(TM) SE Embedded Runtime Environment (build 1.8.0_51-b07, profile compact2, headless)
Java HotSpot(TM) Embedded Server VM (build 25.51-b07, mixed mode)

# docker run --rm -it ofayau/ejre:8-compact3 java -version
java version "1.8.0_51"
Java(TM) SE Embedded Runtime Environment (build 1.8.0_51-b07, profile compact3, headless)
Java HotSpot(TM) Embedded Server VM (build 25.51-b07, mixed mode)

# docker run --rm -it ofayau/ejre:8-jre java -version
java version "1.8.0_51"
Java(TM) SE Embedded Runtime Environment (build 1.8.0_51-b07, headless)
Java HotSpot(TM) Embedded Server VM (build 25.51-b07, mixed mode)

Simple runs

# Run a fat jar from current dir with full JRE
docker run --rm -v "$PWD":/tmp/myapp -w /tmp/myapp ofayau/ejre java -jar myFatJar.jar

Compile and run for compact1

# Compile with jdk 8 (outside container)
javac -profile compact1 HelloWorld.java
# Run a "HelloWorld" class from current dir
docker run --rm -v "$PWD":/tmp/myapp -w /tmp/myapp ofayau/ejre:8-compact1 java HelloWorld.class
Docker Pull Command
Owner
ofayau
Source Repository