Optimized PaperMC Minecraft server Docker image with RCON and health check
50K+
A lightweight, optimized Docker image for running PaperMC Minecraft servers.
Important: This is a third-party Docker image and Helm chart packaging of PaperMC. PaperMC itself is developed and maintained by the PaperMC team, not by this repository's maintainers.
For questions, issues, or support regarding PaperMC server itself (gameplay, plugins, server configuration, etc.), please refer to the official PaperMC resources above.
This repository only provides:
For issues related to the Docker image or Helm chart (container build, deployment, chart configuration), please use this repository's issue tracker.
This server is compatible with:
-XX:MaxRAMPercentage=80%latest - Points to the newest Minecraft version<version> - Specific Minecraft version (e.g., 1.21.5), which points to the same image as its corresponding build tag<version>-<build> - Specific Minecraft version with PaperMC build number (e.g., 1.21.5-20)Example of tag relationships:
latest → <newest-version> → <newest-version>-<build> (all point to the same image)<older-version> → <older-version>-<build> (both point to the same image)To find the latest available tags, check Docker Hub.
This image automatically builds the latest three minor versions within the current major version daily. For example:
Only the three most recent minor versions are maintained, not all versions within a major release range. As new minor versions are released, older ones are removed from active maintenance.
<version>) always point to their corresponding build-specific tags (e.g., <version>-<build>)Recommendation: Use
latesttag for testing, but switch to a specific version-build tag (e.g.,<version>-<build>) for production environments to ensure stability.
A Helm chart is available for Kubernetes deployments, providing easy installation and configuration with support for various plugins, ingress, and advanced networking options.
# Install the chart from GitHub Container Registry
helm install papermc \
oci://ghcr.io/lexfrei/papermc \
--version 0.0.1
# Install with custom values
helm install papermc \
oci://ghcr.io/lexfrei/papermc \
--version 0.0.1 \
--values values.yaml
For detailed chart documentation and configuration examples, see the chart documentation.
| Variable | Description | Default |
|---|---|---|
JAVAFLAGS | JVM flags for optimized performance | Aikar's flags |
PAPERMC_FLAGS | Additional PaperMC server flags | --nojline |
JAVA_MAX_MEM_RATIO | Max heap as percentage of container memory | 80 (80%) |
Note: Memory is automatically managed using
-XX:MaxRAMPercentage. The JVM will use up to 80% of container memory by default. Set container memory limits using Docker's--memoryflag or Kubernetes resource limits.
By default, the JVM uses 80% of container memory. To customize:
# Change memory percentage (use 75% instead of 80%)
docker run -d \
-e JAVA_MAX_MEM_RATIO=75 \
--memory 4G \
lexfrei/papermc:latest
# Disable automatic memory management and set explicit heap size
docker run -d \
-e JAVA_MAX_MEM_RATIO=0 \
-e JAVAFLAGS="-Xms2G -Xmx3G" \
--memory 4G \
lexfrei/papermc:latest
When setting explicit memory (-Xmx), leave ~1GB headroom for JVM metaspace, native memory, and OS overhead.
PaperMC's memory requirements vary based on player count, world size, and installed plugins. Here are some general recommendations:
| Player Count | Recommended Memory | Notes |
|---|---|---|
| 1-5 players | 2GB | Suitable for small, vanilla-like servers |
| 5-15 players | 4GB | Good for moderate plugin usage |
| 15-30 players | 6-8GB | Recommended for larger servers with multiple plugins |
| 30+ players | 10GB+ | For busy servers with many plugins and large worlds |
These values are starting points and should be adjusted based on your specific server performance.
Kubernetes Users: Consider using Vertical Pod Autoscaler to automatically adjust resource limits based on actual usage patterns. This is particularly helpful for Minecraft servers with variable loads.
docker run -d \
--name minecraft-server \
-p 25565:25565/tcp \
-p 25565:25565/udp \
--memory 4G \
-v /path/to/data:/data \
lexfrei/papermc:latest
Note: For production environments, replace
latestwith a specific version-build tag after testing.
version: '3'
services:
papermc:
image: lexfrei/papermc:latest
container_name: minecraft-server
ports:
- "25565:25565/tcp"
- "25565:25565/udp"
volumes:
- ./data:/data
deploy:
resources:
limits:
memory: 4G
restart: unless-stopped
Note: For production deployments, use a specific version-build tag instead of
latest.
See the examples/kubernetes directory for Kubernetes deployment examples.
When running in Kubernetes, consider using the Vertical Pod Autoscaler (VPA) to automatically adjust CPU and memory requests:
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: minecraft-vpa
spec:
targetRef:
apiVersion: "apps/v1"
kind: Deployment
name: minecraft-server
updatePolicy:
updateMode: "Auto"
resourcePolicy:
containerPolicies:
- containerName: "*"
minAllowed:
memory: "1Gi"
cpu: "500m"
maxAllowed:
memory: "8Gi"
cpu: "2"
The VPA will analyze resource usage over time and automatically adjust the resource requests, which helps optimize resource allocation while preventing OOM kills during peak usage.
Running multiple Minecraft servers on the same host is straightforward with this container. Each container needs its own ports and data volume:
version: '3'
services:
survival:
image: lexfrei/papermc:latest
container_name: mc-survival
ports:
- "25565:25565/tcp"
- "25565:25565/udp"
volumes:
- ./survival-data:/data
deploy:
resources:
limits:
memory: 4G
restart: unless-stopped
creative:
image: lexfrei/papermc:latest
container_name: mc-creative
ports:
- "25566:25565/tcp" # Note different host port
- "25566:25565/udp"
volumes:
- ./creative-data:/data
deploy:
resources:
limits:
memory: 4G
restart: unless-stopped
This example runs a survival server on the default port 25565 and a creative server on port 25566.
To install plugins, simply place the JAR files in the /data/plugins directory. PaperMC will automatically load plugins from this directory.
For better organization, you can also use /data/plugins/update as a directory to store plugins that PaperMC will automatically update.
Important: The container runs as a non-root user (UID 9001). When mounting volumes, ensure the
/datadirectory has appropriate permissions.
docker run -d \
--name minecraft-server \
-p 25565:25565/tcp \
-p 25565:25565/udp \
--memory 4G \
-v /path/to/data:/data \
lexfrei/papermc:latest
With this setup, you can add plugins by placing them in /path/to/data/plugins.
These plugins are known to work well with this container:
These are simply recommendations - all standard Paper plugins should work with this container.
Create a server.properties file in your data directory to customize your server settings. If no file exists, a default one will be created on first run.
Example configuration:
server-port=25565
motd=My PaperMC Server
max-players=20
view-distance=10
spawn-protection=0
If you need to use RCON for server management, you have two options:
To enable RCON, add these settings to your server.properties:
enable-rcon=true
rcon.password=your_secure_password
rcon.port=25575
And expose the RCON port when running your container:
docker run -d \
--name minecraft-server \
-p 25565:25565/tcp \
-p 25565:25565/udp \
-p 25575:25575/tcp \ # Expose RCON port
--memory 4G \
-v /path/to/data:/data \
lexfrei/papermc:latest
PaperMC server logs are stored in the /data/logs directory and can be accessed by mounting this volume. You can view them with:
# View logs from the container
docker logs minecraft-server
# Access detailed logs from the mounted volume
cat /path/to/data/logs/latest.log
To customize logging behavior, you can modify /data/log4j2.xml after the first server run. For example, to change retention policy or log levels.
If you're using DynMap, make sure to expose port 8123:
docker run -d \
--name minecraft-server \
-p 25565:25565/tcp \
-p 25565:25565/udp \
-p 8123:8123/tcp \ # Expose DynMap web interface
--memory 4G \
-v /path/to/data:/data \
lexfrei/papermc:latest
Minecraft servers need proper shutdown procedures to save all world data and prevent corruption. This container is configured to handle Docker stop signals correctly.
When stopping the container:
# Allow 30 seconds for clean shutdown
docker stop --time=30 minecraft-server
This gives the server time to save all chunks and player data properly before terminating.
The container includes a reasonable startup-period in its health check to accommodate the time it takes for PaperMC to initialize. Larger worlds and more plugins will increase startup time.
It's recommended to regularly back up your server data. The simplest approach is to stop the container and copy the data directory:
docker stop minecraft-server
cp -r /path/to/data /path/to/backup
docker start minecraft-server
For automated backups, consider using a dedicated backup solution like Duplicati or Restic.
This container uses a single volume at /data which contains all persistent data. Here's what's stored in this volume:
| Path | Description |
|---|---|
/data/world/ | The main world data |
/data/world_nether/ | The Nether dimension |
/data/world_the_end/ | The End dimension |
/data/plugins/ | All installed plugins |
/data/config/ | Configuration files |
/data/logs/ | Server logs |
/data/server.properties | Main server configuration |
/data/banned-ips.json | IP ban list |
/data/banned-players.json | Player ban list |
/data/ops.json | Server operators list |
/data/whitelist.json | Whitelisted players list |
When mounting volumes, always ensure the entire /data directory is preserved to maintain all server state.
If you're seeing permission errors when the container tries to access your mounted volumes, it's likely due to the container running as a non-root user (UID 9001) while your host directories have different ownership.
Solution: Change the ownership of your data directory to match the container's user (9001):
sudo chown -R 9001:9001 /path/to/data
If the container crashes with java.lang.OutOfMemoryError, your memory limits may be too low.
Solution: Increase the container memory limit:
docker run -d --memory 6G ... lexfrei/papermc:latest
For Kubernetes, update your resource limits:
resources:
limits:
memory: "6G"
Check the logs with:
docker logs minecraft-server
Common issues include:
This image includes a socket-based health check. If the health check fails:
If you experience world corruption:
docker stop --time=30 minecraft-server)If players cannot connect to your server:
docker logs minecraft-serverIf a plugin is causing issues:
If you're migrating from another Minecraft container (like itzg/minecraft-server):
/data/world or similar path)sudo chown -R 9001:9001 /path/to/new/dataWhen upgrading Minecraft versions:
--forceUpgrade flagdocker build -t lexfrei/papermc:latest .
Contributions are welcome! Please see the CONTRIBUTING.md file for guidelines.
This project is licensed under the BSD License - see the LICENSE file for details.
Content type
Image
Digest
sha256:3f9b29322…
Size
200.4 MB
Last updated
about 16 hours ago
docker pull lexfrei/papermc