Service: Minecraft Server - EyevinnOSC/community GitHub Wiki

Minecraft Server

Minecraft Server (serviceId itzg-docker-minecraft-server) is the Dockerized Minecraft Java Edition server maintained by itzg. It handles EULA acceptance, world generation, game mode configuration and RCON remote administration. In Eyevinn Open Source Cloud (OSC) it is a long-running service instance with up to 10 GiB of storage per instance. License: Apache-2.0. Source: itzg/docker-minecraft-server.

What it can do

  • Run a multiplayer Minecraft: Java Edition server with the game mode, difficulty and world rules you choose.
  • Allow remote administration through RCON.
  • Players need a Minecraft: Java Edition license to connect.

Creating an instance

Decide the game settings first, and store the RCON password as a service secret: create-service-secret with serviceId: "itzg-docker-minecraft-server", name rconpassword and your chosen password. Then call create-service-instance with serviceId: "itzg-docker-minecraft-server". The instance name must be alphanumeric and at most 20 characters. The server has no dependencies on other OSC services. AcceptEula must be true, which means you accept the Minecraft EULA.

{
  "name": "myserver",
  "AcceptEula": true,
  "RconPassword": "{{secrets.rconpassword}}",
  "Mode": "survival",
  "Difficulty": "normal"
}

Wait with wait-for-service-ready (or get-instance-status), then use describe-service-instance to read the server address (host:port).

Options

Option values feed the corresponding environment variables of the itzg image (for example Mode feeds MODE, MaxWorldSize feeds MAX_WORLD_SIZE, GeneralStructures feeds GENERATE_STRUCTURES).

Option Required Type Meaning
name Yes string Name of the instance. Alphanumeric/underscore only, at most 20 characters.
AcceptEula Yes boolean Must be true to accept the Minecraft EULA. The server will not start without it.
RconPassword Yes string, sensitive Password for RCON (Remote Console) remote administration and command execution. Store as a service secret and pass {{secrets.NAME}}.
Mode Yes string Game mode: survival (the image default), creative, adventure or spectator (gamemode server property).
Difficulty No string peaceful, easy, normal or hard.
MaxWorldSize No string (number) Maximum radius of the world border in blocks; players cannot move beyond it.
AllowNether No boolean Enables or disables access to the Nether. When disabled, nether portals do not work.
AnnouncePlayerAchievements No boolean Whether achievements are announced to all players.
EnableCommandBlock No boolean Enables or disables command blocks.
ForceGamemode No boolean Forces players to join in the default game mode and prevents them from changing it.
GeneralStructures No boolean Whether structures such as villages and dungeons generate in new chunks (generate-structures).
Hardcore No boolean Hardcore mode: players are banned from the server when they die.
SpawnAnimals No boolean Whether passive animals spawn naturally.
SpawnMonsters No boolean Whether hostile monsters spawn naturally.
SpawnNpcs No boolean Whether NPCs such as villagers spawn naturally.
Seed No string Seed for world generation (level-seed). Applies when a new world is created.
MaxPlayers No string (number) Maximum number of simultaneous players (max-players).
Type No string Server type of the itzg image (TYPE); the image default is VANILLA. See the itzg documentation for supported types.
Pvp No string Player-versus-player combat (pvp), true or false.
OnlineMode No string Whether players are authenticated against Minecraft's account service (online-mode), true or false.
Memory No string JVM heap size (MEMORY in the itzg image), for example 1G; the image default is 1G.

RconPassword should be a {{secrets.NAME}} reference; a reference must be the entire field value. Overwriting a secret does not restart a running instance.

Using the instance

  1. Open Minecraft: Java Edition and go to Multiplayer > Add Server.
  2. Enter the server address (host:port) from describe-service-instance.
  3. Click Done, select the server and click Join Server.

CLI usage

osc create itzg-docker-minecraft-server myserver \
  -o AcceptEula=true \
  -o RconPassword="mysecurepassword" \
  -o Mode="survival" \
  -o Difficulty="normal"

Resources