Game Servers
Running multiplayer game servers often means keeping long-lived VMs online, pre-warming for peak hours, and paying for idle time between sessions. On Unikraft Cloud, you can run game servers in microVMs with stateful scale-to-zero, so instances pause when idle and resume when players reconnect.
Minecraft is a strong example of this pattern. JVM startup and world initialization are expensive, but template snapshots and stateful resume keep player experience smooth without running infrastructure every day.
Why use Unikraft Cloud for game servers
Fast restarts from template snapshots
Game servers often have expensive startup paths: loading assets, initializing runtime state, and binding network services. Unikraft Cloud's instance templates snapshot the server after initialization, so later starts resume from a warm state instead of repeating full initialization. For Minecraft specifically, this avoids repeated JVM warm-up and world initialization work.
Stateful scale-to-zero
When all players disconnect, the instance enters standby and consumes no active resources. On the next connection it wakes from the same in-memory snapshot, preserving server state without a full restart. For Minecraft, this means your world and server process resume from snapshot instead of cold booting.
Isolation per server
Each server runs in its own microVM: no shared kernel with other tenants, no container escape surface, and no noisy-neighbour risk.
Quick iteration with ROM
Server settings can ship as auxiliary ROMs at instance creation time. You can run distinct game-server variants by swapping ROM configuration rather than rebuilding the base image.
Getting started
This guide uses the minecraft example.
The base image is built from itzg/minecraft-server (Java 25) and includes:
- A
wrapper.shentrypoint that starts SSH, loads ROM configuration, and disables scale-to-zero during initialization. - Patched startup scripts that snapshot the instance into a template before full server warm-up.
Prerequisites
-
Install the CLI. Use the unikraft CLI or the legacy kraft CLI. You need a BuildKit builder. The easiest way to get one is via Docker. You can also set up and use BuildKit directly; see the quick start.
The unikraft CLI is the current standard, while kraft is the legacy version. Choose one of the CLIs below and only run the commands associated with it for the rest of this guide.
-
Clone the
examplesrepository andcdinto theexamples/minecraft/directory:Code -
Review and adjust the base server settings in
base/.env. You can check out this documentation for available configuration options. Make sure to also set yourPUBKEYfor SSH access, and optionally setTEMPLATE_WITH_WORLDif you want the template to include the world (see below). Optionally, create per-config overrides in<config>/.env. All.envfiles are packaged as auxiliary ROMs and mounted at/rom/<config>.
Make sure to log into Unikraft Cloud and pick a metro close to you.
This guide uses fra (Frankfurt, 🇩🇪):
Step 1: Package and push the base image
First, package and push the base Minecraft server image:
The image contains the files from the Docker image itzg/minecraft-server and includes a few tweaks:
- The entrypoint uses a custom
wrapper.shscript that:- Starts an SSH server
- Loads the environment configuration from the attached ROMs
- Disables scale-to-zero before executing the original entrypoint
- The server configuration scripts from the original image have patches to trigger the template snapshot before the full warm-up of the server, which allows faster instance creation from the template. Scale-to-zero is then re-enabled after server initialization.
Step 2: Create a template from the base image
Boot a short-lived instance from the base image. The startup script snapshots it into a template before world generation, then the instance exits.
Pass your server settings as a ROM:
The output shows the instance details:
If you also have per-config overrides (for example in bingo/.env), create the instance with more ROMs:
The instance runs until initialization completes, then the platform snapshots it as a template and immediately deletes it.
You can configure the exact moment of snapshotting in patches/start-finalExec or with the following environment variable:
- If
TEMPLATE_WITH_WORLD=true, then the snapshot will trigger after world generation - Otherwise, the snapshot will trigger after extracting the jar files and writing configuration files, before world generation
Follow the template instance logs until they stop:
Confirm the template is ready:
Step 3: Launch a server from the template
The output includes the service address:
The instance address is https://hidden-water-ewr8l9sp.fra.unikraft.app.
Follow the logs until the server is ready:
Code
Connect to the server
Limited Access
At the moment, Unikraft Cloud exposes services over TLS.
Minecraft and SSH clients speak plain TCP, so use socat to end TLS locally.
Minecraft
Code
Connect your Minecraft client to localhost:25565.
SSH
Code
Connect to localhost:2222 with username root and the SSH key set in .env.
Administration
Remote console
SSH into the instance, then:
Code
Example commands:
Whitelist in offline mode
Offline mode generates UUIDs that differ from online UUIDs.
Compute the correct UUID per username and add it to /data/whitelist.json:
Code
Cleanup
Learn more
Use the --help option for detailed information on using Unikraft Cloud:
Or visit the CLI Reference or the legacy CLI reference.
For more information on the features used in this use case and how to use them, check out the following documentation: