This is a Docker-based Minecra## Important Notes
- Railway/Koyeb free tiers have CPU and memory limits - modded Minecraft servers often need 2-4GB RAM
- Consider upgrading to paid plans for better performance and stability
- Monitor resource usage in your dashboard - check for OOM (Out of Memory) errors
- Back up your world data regularly
- The HTTP server only responds to health checks - actual Minecraft connections use TCP Edition server setup with a health check HTTP server for deployment on Railway or Koyeb.
- Automatically downloads the latest Minecraft server version
- Includes HTTP health check server to prevent timeouts
- Uses lightweight Alpine Linux base image for better performance
- Configurable server properties
- Ready for Railway/Koyeb deployment
-
Push to GitHub: Commit and push this code to a GitHub repository.
-
Connect to Railway:
- Go to railway.app
- Connect your GitHub repository
- Railway will auto-detect the Dockerfile
-
Environment Variables:
PORT
: Set to8080
(for health checks)MAX_MEMORY
: Set to1G
(conservative for free tier)INITIAL_MEMORY
: Set to512M
-
Port Configuration: Railway will use the PORT variable for HTTP health checks. Minecraft runs on 25565 internally.
-
Public URL: Railway provides a domain, but for Minecraft connections, you'll need the Railway TCP proxy or use the internal networking.
-
Push to GitHub: Commit and push this code to a GitHub repository.
-
Create Koyeb Account: Sign up at koyeb.com
-
Deploy Service:
- Go to dashboard → Create Service → Docker
- Connect your GitHub repository
- Set port:
8080
(HTTP for health checks) - Add TCP port 25565 for Minecraft connections
- Environment variables:
MAX_MEMORY=1G
,INITIAL_MEMORY=512M
-
Persistence: Add a volume mount for
/minecraft
to persist world data.
Edit server.properties
to customize your server:
motd
: Server messagedifficulty
: easy/medium/hardmax-players
: Maximum players (keep low for free tiers)online-mode
: Set to false if you want cracked clients (not recommended)
PORT
: HTTP port for health checks (default: 8080)MAX_MEMORY
: Maximum Java heap size (default: 1G - conservative for Railway)INITIAL_MEMORY
: Initial Java heap size (default: 512M)
To test locally with Docker:
docker build -t minecraft-server .
docker run -p 8080:8080 -p 25565:25565 -e PORT=8080 minecraft-server
Connect Minecraft to localhost:25565
- Railway/Koyeb free tiers have CPU and memory limits
- Consider upgrading to paid plans for better performance
- Monitor resource usage in your dashboard
- Back up your world data regularly
- The HTTP server only responds to health checks - actual Minecraft connections use TCP
- 502 Bad Gateway: Usually means the HTTP health check server isn't responding
- Out of Memory (OOM) errors: Increase MAX_MEMORY/INITIAL_MEMORY environment variables or upgrade your plan
- Server crashes: Check memory allocation and mod compatibility
- Connection refused: Ensure port 25565 is properly exposed
- Slow performance: Increase MEMORY or upgrade your plan
- Railway deployment failures: Check Railway metrics for memory usage patterns
This setup uses the official Minecraft server software. Make sure to comply with Mojang's EULA.