JEP 386: Alpine Linux/x64 Port

OwnerBoris Ulasevich
Componenthotspot / runtime
Discussionportola dash dev at openjdk dot java dot net
Reviewed byVladimir Kozlov
Created2019/08/13 10:33
Updated2020/07/23 23:55


Port the JDK to Alpine Linux/x64 and other Linux distributions that use musl as their primary C library.


Musl is an implementation, for Linux-based systems, of the standard library functionality described in the ISO C and POSIX standards. Several Linux distributions including Alpine Linux and OpenWrt are based on musl, while some others provide an optional musl package (e.g., Arch Linux).

The Alpine Linux distribution is widely adopted in cloud deployments, microservices, and container environments due to its small image size. A Docker base image for Alpine Linux, for example, is less than 6 MB. Enabling Java to run out-of-the-box on such deployments will allow Tomcat, Jetty, Spring, and other popular frameworks to support such environments natively.

By using jlink (JEP 282) to reduce the size of the Java runtime, a user will be able to create an even smaller image targeted to run a specific application. The set of modules required by an application can be determined via the jdeps command. For example, if a target application depends only on the java.base module then a Docker image with Alpine Linux and a Java runtime with just that module and the server VM would fit in 38 MB.

The same motivation applies to embedded deployments, which also have size constraints.


This JEP intends to integrate the Portola Project upstream.

This port will not support the attach mechanism of the HotSpot Serviceability Agent.

To build a musl variant of the JDK on Alpine Linux, the following packages are required:

alpine-sdk alsa-lib alsa-lib-dev autoconf bash cups-dev cups-libs fontconfig fontconfig-dev freetype freetype-dev grep libx11 libx11-dev libxext libxext-dev libxrandr libxrandr-dev libxrender libxrender-dev libxt libxt-dev libxtst libxtst-dev linux-headers zip

Once these packages are installed, the JDK build process works as usual.

Musl ports for non-x64 architectures may be implemented in follow-up enhancements, if there is demand.