Minimal Java image using Oracle JDK 8 and Debian Jessie
10K+
This is a base image for Java. Unlike the default java:latest image it uses Oracle JDK rather than OpenJDK.
We've put some effort into making the image smaller (453mb vs 817mb for _/java) by:
You can go further by deleting the JavaFX and other platform specific libraries, but we wanted to offer a generic image.
The entrypoint is setup to be 'java' and directory called /java is offered the working directory and a shared volume. So you can run commands such as:
docker run -u $(id -u) -v $(pwd):/java committed/java -jar jar-in-current-directory-on-host.jar
This will run the Jar file from the current directory (on the host) as the host user.
If you wish to access the container without running Java, then you can override with --entrypoint:
docker run --entrypoint /bin/bash committed/java
When you build your Dockerfile from this image, you should add/download jar and then override the ENTRYPOINT (and CMD).
In its most basic form, something along the lines of:
FROM committed/java
MAINTAINER Me <[email protected]>
# Provide a Jar filename and version
ENV JAR_FILENAME myfatjar-1.0.0.jar
# Either, download the Jars (eg direct from github releases)
RUN wget https://example.com/path/to/${JAR_FILENAME}
# Or ADD form from local
# ADD ${JAR_FILENAME} ${JAR_FILENAME}
# Run, defaulting to help
ENTRYPOINT ["java", "-jar", "${JAR_FILENAME}"]
CMD "--help"
Of course you'll likely also want to install other packages, add volumes, expose ports and set users.
Content type
Image
Digest
sha256:b4858251c…
Size
173.4 MB
Last updated
almost 10 years ago
docker pull committed/java