This container provides multiple Java runtimes for use with Pterodactyl eggs or any environment that needs to switch Java versions. OpenJDK 8, 11, 16, 17, 21 and 22 are installed.
# Build each image
docker build -t Multi-OpenJDK:Headless -f OpenJDK/Headless/Dockerfile .
docker build -t Multi-OpenJDK:JRE -f OpenJDK/JRE/Dockerfile .
docker build -t Multi-OpenJDK:JDK -f OpenJDK/JDK/Dockerfile .
# Example run showing the selected JRE
docker run --rm -it -e STARTUP="java -version" Multi-OpenJDK:HeadlessEnvironment variables recognised by the image:
JAVA_VERSION– default JRE version when.javaveris absent. Defaults to22.STARTUP– command template executed on container start.{{VAR}}placeholders are expanded.TZ– optional timezone, defaultUTC.JAVA_DIR– directory of installed JREs (/opt/java).JAVA_HOMEis derived from the chosen version.INTERNAL_IP– automatically populated with the container's internal address.
At runtime the entrypoint looks for a .javaver file in the working directory. If it contains a version number (for example 17) that version is used instead of JAVA_VERSION.
The repository uses a GitHub Actions workflow to publish the image to GitHub Container Registry. The workflow is triggered on pushes to main or via manual dispatch and builds a multi-arch image:
name: Build and Push Multi-Arch Docker Image to GHCR
on:
workflow_dispatch:
push:
branches: [ main ]
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_PAT }}
- name: Build and Push Docker Images
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/king-snakes/multi-openjdk:Headless
ghcr.io/king-snakes/multi-openjdk:JRE
ghcr.io/king-snakes/multi-openjdk:JDKThe resulting images are tagged as:
ghcr.io/king-snakes/multi-openjdk:Headlessghcr.io/king-snakes/multi-openjdk:JREghcr.io/king-snakes/multi-openjdk:JDK