Run your first server
Get a basic Minecraft server running in under 5 minutes using Docker run commands.Accept the Minecraft EULA
Before running any server, you must accept the Minecraft EULA by including
-e EULA=TRUE in all commands.Run the basic server
Execute this command to start a server with the latest Minecraft version:This command:
- Downloads and runs the latest vanilla Minecraft server
- Exposes port 25565 for player connections
- Runs in detached mode (
-d) - Enables interactive terminal (
-it) for console access
The server data is stored in an anonymous Docker volume. To persist your world and configuration, see the persistent data section below.
Persistent data
The Minecraft server stores all its data in the container’s/data directory. To keep your world and configuration when the container is removed, mount a volume or directory.
Using a host directory
Mount a directory from your host machine to persist the server data:/path/on/host with the actual path where you want to store the server data, such as:
- Linux/Mac:
/home/user/minecraft-data - Windows:
C:\Users\username\minecraft-data
For rootless containers (Podman) or systems using SELinux/AppArmor, append
:Z to the volume mapping:Using a named volume
Create and use a named Docker volume:Common configurations
Specific Minecraft version
Run a specific version instead of the latest:Different server types
Run Paper, Spigot, Forge, or other server types:Server properties
Configure server settings using environment variables:All standard
server.properties entries can be set via environment variables. The variable names match the property names in uppercase.Managing your server
View server logs
Follow the server console output:Stop the server
Gracefully stop the server:Start the server
Start a stopped container:Access server console
Attach to the server console for commands:Ctrl+P, Ctrl+Q to detach without stopping the server.
Restart for updates
When usingVERSION=LATEST or VERSION=SNAPSHOT, simply restart the container to upgrade:
Common environment variables
Here are the most commonly used environment variables:| Variable | Default | Description |
|---|---|---|
EULA | - | Must be set to TRUE to accept the Minecraft EULA |
VERSION | LATEST | Minecraft version: LATEST, SNAPSHOT, or specific version like 1.20.4 |
TYPE | VANILLA | Server type: VANILLA, PAPER, SPIGOT, FORGE, FABRIC, etc. |
MEMORY | 1G | JVM memory allocation, e.g., 2G, 4G, 8G |
MAX_PLAYERS | 20 | Maximum number of players |
VIEW_DISTANCE | 10 | Server view distance in chunks |
DIFFICULTY | easy | Game difficulty: peaceful, easy, normal, hard |
MODE | survival | Game mode: survival, creative, adventure, spectator |
MOTD | Auto-generated | Server message of the day |
LEVEL_TYPE | DEFAULT | World type: DEFAULT, FLAT, LARGEBIOMES, AMPLIFIED |
SEED | - | World generation seed |
PVP | true | Enable player vs player combat |
ALLOW_NETHER | true | Enable the Nether dimension |
For a complete list of available environment variables and server types, see the full documentation.
Example: Complete server setup
Here’s a complete example with common settings:- Runs a Paper server on Minecraft 1.20.4
- Allocates 4GB of RAM
- Supports up to 50 players
- Persists data to
~/minecraft-data - Automatically restarts unless manually stopped
- Uses normal difficulty and survival mode
Next steps
Docker Compose setup
Learn how to use Docker Compose for easier management
Full documentation
Explore advanced features like mods, plugins, and backups