Running in Docker
This page demonstrates example settings for running a Minecraft server in a Docker container, using the PAPER 1.20.4 server core as an example.
1. Preparing the Environment
Before starting, make sure you have the following software installed:
- Docker (Official Website)
2. Configuration File
Create a file named docker-compose.yml in a convenient location with the following content:
- Original
- Example Filled File
version: '3.8'
services:
mc:
image: itzg/minecraft-server
tty: true
stdin_open: true
ports:
- "25565:25565"
environment:
# Server core type
TYPE: PAPER
# Server version
VERSION: 1.20.4
EULA: "TRUE"
ONLINE_MODE: "TRUE"
ENFORCE_SECURE_PROFILE: "FALSE"
# RAM allocation
MEMORY: 4G
JVM_OPTS: "-javaagent:{PATH_TO_authlib-injector-1.2.5.jar}=https://{YOUR_GML_API_ADDRESS}/api/v1/integrations/authlib/minecraft -Dauthlibinjector.debug"
volumes:
# Create volume to persist server data
- ./data:/data
version: '3.8'
services:
mc:
image: itzg/minecraft-server
tty: true
stdin_open: true
ports:
- "25565:25565"
environment:
# Server core type
TYPE: PAPER
# Server version
VERSION: 1.20.4
EULA: "TRUE"
ONLINE_MODE: "TRUE"
ENFORCE_SECURE_PROFILE: "FALSE"
# RAM allocation
MEMORY: 4G
JVM_OPTS: "-javaagent:libraries/authlib-injector-1.2.5-alpha-1.jar=https://localhost:5003/api/v1/integrations/authlib/minecraft -Dauthlibinjector.debug"
volumes:
# Create volume to persist server data
- ./data:/data
Note that in this example, the file is placed in the libraries folder of your game server.
Important!
Do not leavelocalhost:5003if the server will be used by other players or deployed on a remote machine!
In the-javaagentparameter, replacehttps://localhost:5003/api/v1/integrations/authlib/minecraftwith the address of your API where the authlib injector integration is deployed.
If your server is available at https://api.example.com, the line should look like this:
-javaagent:libraries/authlib-injector-1.2.5-alpha-1.jar=https://api.example.com/api/v1/integrations/authlib/minecraft -Dauthlibinjector.debug
3. Downloading the Libraries
Create a folder data/libraries and download authlib injector into it.
The final hierarchy should look like this:
📁 data
|-- 📁 libraries
|-- 📄 authlib-injector-1.2.5-alpha-1.jar
📄 docker-compose.yml
4. First Launch
Run the following command in the console:
docker compose up