Skip to content
Minimal Play 2.8.0 running on openjdk13/alpine-slim docker image.
Scala Shell
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
deps Update deps with input from nigredo-tori Dec 19, 2019
project Add jolokia and hawt Dec 16, 2019
src/main Add a logger for java serialization Dec 19, 2019
.gitignore Fix permissions on logs Dec 18, 2019
.java-version Initial commit Dec 15, 2019
build.sbt Update with bind mounts Dec 18, 2019
run-docker Fix permissions on logs Dec 18, 2019

Play 2.8.0 using JDK 13 on Slim Alpine Docker

Here's a minimal Play 2.8.0 running on a trimmed down Java 13 image using an Alpine.

JLink Attempt

I made an attempt to create a custom JLink image to trim it down further, but didn't succeed. See the deps directory for details.


The first thing you should do is install SDKMAN and jenv, which will let you be specific about what JDK version you want.

Install SDKMAN and jenv

SDKMAN is the best way to pick out different versions of Java and have them all co-exist.

jenv is the best way to set different JDKs for different projects.

You can install multiple JDKs and have them available. Here, we'll use the OpenJDK 13.0.1 image.

$ sdk install java 13.0.1.hs-adpt

After that, you can see the JDK available in $HOME/.sdkman/candidates/java/13.0.1-zulu.

Now that you've got the JDK available, let's tell jenv about it:

$ jenv add $HOME/jenv add $HOME/.sdkman/candidates/java/13.0.1.hs-adpt

And then we'll set it as the default for this project.

$ jenv local 13.0

This will create a .java-version file in your directory that picks up and points you to the JDK.

$ java --version 
openjdk 13.0.1 2019-10-15
OpenJDK Runtime Environment AdoptOpenJDK (build 13.0.1+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 13.0.1+9, mixed mode, sharing)

Now you're running JDK 13 for your project.


Publish a local docker image with

sbt docker:publishLocal


Run the local image with

docker run \
  -p 9000:9000 \
  --rm \
  --env "PLAY_APPLICATION_SECRET=very-long-secret-for-entropy" \

Or run ./run-docker.

Then go to http://localhost:9000.

Monitoring and Control Plane

Diagnostics and control of the JVM is managed through Jolokia running as an agent. You can control the JVM and see how the GC is running by running Hawt in another console window:

java -jar hawt/hawtio-app-2.8.0.jar

Or by running ./run-hawt.

Once hawt is up and running, add the connection as "http://localhost:8778/jolokia" and from there you can see GC and dump JFR logs.


Logs are exported from /opt/docker/logs

You can’t perform that action at this time.