bellsoft/liberica-openjdk-alpine-musl
Liberica is a 100% open-source Java implementation by BellSoft
1M+
Liberica JDK is free and 100% open-source Progressive Java Runtime for modern Java deployments. It is developed and supported by BellSoft, a major OpenJDK contributor. Application development with Liberica JDK is
Liberica JDK is recommended and used by Spring as the end-to-end solution for Spring Native applications. BellSoft serves millions of developers and companies from various industries across the globe. For more information, visit www.bell-sw.com.
We compiled an interactive scheme that will help you decide which BellSoft’s image is perfect for your project.
This repository contains Alpine musl Docker images of Liberica JDK. Alpine Linux is a lightweight Linux distribution with the base image of ~5MB, which allows minimizing the size of a container. We have been shipping images of Liberica JDK with Alpine musl since JDK 11. BellSoft’s engineers have upstreamed the support of this OS into JDK 16 and beyond as part of the Portola Project, and now we produce the smallest containers on the market that are only 42.72 MB, which are compatible with all Java applications.
Liberica JDK images for Alpine are available for following architectures:
The tags point at the Java version (right after the OS name) and supported architecture. Image name structure: X-Y, where X is the Java version and Y is the architecture type. If the architecture type is not included into the name, then the build supports AMD64 and ARM64 by default. The ‘latest’ tag points to the latest version of an image. Images with '-cds' in tag contain CDS (Class Data Sharing) archive. For instance, bellsoft/liberica-openjdk-alpine-musl:8u352-8-x86_64 is an image with Liberica JDK version 8u352-8 for Alpine musl running on x86_64
Alpaquita is a lightweight Linux distribution that integrates all the main features of Alpine plus multiple enhancements and enterprise support.
Like Alpine, Alpaquita is a small and performant Linux distribution, but in addition to that, it
The most important Alpaquita’s feature for the enterprise development is the support from the BellSoft team. Containers with Alpaquita and Liberica JDK are a unified solution with tested and perfectly compatible components that receive support and regular updates from a single vendor. Our clients obtain fixes on demand, which are implemented in the next release and become available for everyone. We provide Long-Term Support and a software bill of materials both for Liberica JDK and Alpaquita Linux.
As such, containers with Alpaquita are a free and better alternative to Alpine-based solutions.
You can find them at https://hub.docker.com/r/bellsoft/liberica-runtime-container
latest
,
latest-cds
,
23.0.1-13
,
23.0.1-13-cds
,
23.0.1
,
23.0.1-cds
,
23-38-cds
,
23-cds
,
23-38
,
23
,22
,
22-cds
21.0.5-11
,
21.0.5-11-cds
,
21.0.5
,
21.0.5-cds
,
21.0.4-9
,
21.0.4-9-cds
,
21.0.4
,
21.0.4-cds
,
21.0.3-10
,
21.0.3-10-cds
,
21.0.3
,
21.0.3-cds
,
21.0.1-16
,
21.0.1-16-cds
,
21.0.1-12
,
21.0.1-12-cds
,
21.0.1
,
21.0.1-cd
,
21
,
21-cds
20
19
18
17.0.13-12
,
17.0.13-12-cds
,
17.0.13
,
17.0.13-cds
,
17.0.12-10
,
17.0.12-10-cds
,
17.0.12
,
17.0.12-cds
,
17.0.11-10
,
17.0.11-10-cds
,
17.0.11
,
17.0.11-cds
,
17
,
17-cds
16
15
14
,13
12
11.0.25-11
,
11.0.25-11-cds
,
11.0.25
,
11.0.25-cds
,
11.0.24-9
,
11.0.24-9-cds
,
11.0.24
,
11.0.24-cds
,
11.0.23-10
,
11.0.23-10-cds
,
11.0.23
,
11.0.23-cds
,
11.0.21-10
,
11.0.21-10-cds
,
11.0.21
,
11.0.21-cds
,
11
,
11-cds
8u432-7
,
8u432-7-cds
,
8u432
,
8u432-cds
,
8u422-6
,
8u422-6-cds
,
8u422
,
8u422-cds
,
8u412-9
,
8u412-9-cds
,
8u412
,
8u412-cds
,
8u392-9
,
8u392-9-cds
,
8u392
,
8u392-cds
,
8u
,
8u-cds
,
8
,
8-cds
curl https://raw.githubusercontent.com/bell-sw/Liberica/master/docker/repos/liberica-openjdk-alpine-musl/17/Dockerfile --output Dockerfile
docker build . --build-arg LIBERICA_IMAGE_VARIANT=[standard|lite|base|base-minimal]
Dockerfile for Alpine Linux (musl variant) supports four target images out of the box:
Target can be chosen by modifying argument LIBERICA_IMAGE_VARIANT or redefining it via --build-arg parameter to have specific Liberica image installed.
To save space, users are encouraged to create their own runtimes using jmod command sufficient to run the target application.
If you are ready to sacrifice performance for static footprint, please consider using Minimal VM instead of Server VM or Client VM. With that, it's possible to create a runtime as small as < 20 Mb.
LIBERICA_USE_LITE
– defines content of JDK for this image. 0
means keep jdk unchanged, 1
(default) creates lite image, where demos, samples and sources are removed from image.LIBERICA_IMAGE_VARIANT
– possible image variants are:
base
– server VM with java.base
module.base-minimal
– minimal VM with java.base
module.lite
(default) – lite JDK with minimal footprint.standard
– standard JDK.LIBERICA_VM
– this option defines included VM for lite and standard image variant. Possible values are:
server
(default) – add server
VM to image.client
– add client
VM to image.minimal
– add minimal
VM to image.all
– add all VMs from original bundle to image.For example, you can run a Liberica OpenJDK 14 container with the following command:
docker run -it --rm bellsoft/liberica-openjdk-alpine-musl:latest java -version
To run some application you can create Dockerfile, based on bellsoft/liberica-openjdk-alpine-musl image or mount volume with your code/applicaiton, for example:
docker run -it --rm -v /home/user/project/:/data bellsoft/liberica-openjdk-alpine-musl:latest java -jar /data/MyApp.jar
Containerized deployments sometimes do some off-screen rendering, such as when preparing documents, forms, and images. When performing off-screen rendering, the JDK requires OS fonts and fontconfig
libraries to be present.
In case when you don't have these libraries or fonts you will encounter the exception, similar to one below:
Exception in thread "main" java.lang.InternalError: java.lang.reflect.InvocationTargetException
at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:86)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
at java.desktop/sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)
at java.desktop/sun.font.SunFontManager.getInstance(SunFontManager.java:247)
at java.desktop/sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:261)
at java.desktop/sun.swing.SwingUtilities2.getFontMetrics(SwingUtilities2.java:1243)
...
at jdk.compiler/com.sun.tools.javac.launcher.Main.run(Main.java:192)
at jdk.compiler/com.sun.tools.javac.launcher.Main.main(Main.java:132)
Caused by: java.lang.NullPointerException
at java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1262)
at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:225)
at java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:107)
at java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:719)
at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:362)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
at java.desktop/sun.font.SunFontManager.<init>(SunFontManager.java:307)
at java.desktop/sun.awt.FcFontManager.<init>(FcFontManager.java:35)
at java.desktop/sun.awt.X11FontManager.<init>(X11FontManager.java:56)
... 28 more
On Alpine Linux, these libraries are provided by fontconfig
and ttf-dejavu
packages, and can be installed by running the following command:
apk add fontconfig ttf-dejavu
The Liberica JDK Dockerfile can be built with these libraries by specifying OPT_PKGS
build argument:
docker build -t bellsoft/liberica-openjdk-alpine-musl:15 \
--build-arg LIBERICA_VERSION=15.0.1-9 \
--build-arg LIBERICA_BUILD=9 \
--build-arg LIBERICA_VARIANT=jdk \
--build-arg LIBERICA_ROOT=/usr/lib/jvm/jdk-15-bellsoft-x86_64 \
--build-arg OPT_PKGS="fontconfig ttf-dejavu"
docker pull bellsoft/liberica-openjdk-alpine-musl