Skip to main content
The Docker Minecraft Server can be deployed in various environments and architectures, from simple single-container setups to complex orchestrated deployments with auto-scaling capabilities.

Deployment Options

Docker Compose

The most common and recommended way to deploy is using Docker Compose, which provides:
  • Easy configuration management
  • Volume and network orchestration
  • Service dependencies
  • Restart policies
  • Environment variable management

Simple Deployment

Basic single-server setup with persistent storage

Advanced Features

Multi-service deployments with RCON, proxies, and more

Kubernetes

For production environments requiring:
  • High availability
  • Auto-scaling
  • Resource management
  • StatefulSets for persistent data
See the Kubernetes deployment guide for detailed information.

Docker Swarm

Swarm mode provides:
  • Native Docker clustering
  • Service replication
  • Load balancing
  • Rolling updates
See the Docker Swarm guide for stack configurations.

Simple Compose

The simplest deployment requires just a few lines:
docker-compose.yml
services:
  minecraft:
    image: itzg/minecraft-server
    stdin_open: true
    tty: true
    ports:
      - "25565:25565"
    volumes:
      - ./data:/data
    environment:
      EULA: "TRUE"
    restart: unless-stopped
1

Create compose file

Save the configuration above as docker-compose.yml
2

Start the server

docker compose up -d
3

View logs

docker compose logs -f
The stdin_open and tty options enable interactive console access via docker attach.

Advanced Compose

A production-ready deployment with resource limits and named volumes:
docker-compose.yml
services:
  minecraft:
    image: itzg/minecraft-server
    container_name: mc-server
    ports:
      - "25565:25565"
    volumes:
      - "mc-data:/data"
    environment:
      EULA: "TRUE"
      MAX_MEMORY: 32G
      MAX_BUILD_HEIGHT: 256
      VIEW_DISTANCE: 15
      LEVEL_TYPE: LARGEBIOMES
      MAX_PLAYERS: 100
      CONSOLE: "false"
    restart: always
    
  rcon:
    image: itzg/rcon
    ports:
      - "4326:4326"
      - "4327:4327"
    volumes:
      - "rcon:/opt/rcon-web-admin/db"

volumes:
  mc-data:
  rcon:

Key Configuration Elements

Named volumes (recommended for production):
volumes:
  - "mc-data:/data"
Bind mounts (easier for development):
volumes:
  - ./data:/data
  - ./mods:/mods
Named volumes are managed by Docker and persist independently of the container lifecycle.
Standard Minecraft port:
ports:
  - "25565:25565"  # host:container
Custom external port:
ports:
  - "30000:25565"  # Listen on port 30000
Multiple servers:
# Server 1
ports:
  - "25565:25565"

# Server 2
ports:
  - "25566:25565"
Control memory allocation:
environment:
  MEMORY: "4G"          # Initial and max memory
  MAX_MEMORY: "8G"      # Maximum JVM heap
  INIT_MEMORY: "2G"     # Initial JVM heap
Ensure your host has sufficient RAM. Java will allocate the specified amount plus additional overhead.
Available restart policies:
  • no - Never restart automatically
  • on-failure - Restart only on error
  • always - Always restart regardless of stop reason
  • unless-stopped - Restart unless explicitly stopped (recommended)
restart: unless-stopped

Environment-Specific Configurations

Development

docker-compose.yml
services:
  mc:
    image: itzg/minecraft-server
    tty: true
    stdin_open: true
    ports:
      - "25565:25565"
    volumes:
      - ./data:/data
      - ./mods:/mods        # Mount local mods directory
      - ./plugins:/plugins  # Mount local plugins directory
    environment:
      EULA: "TRUE"
      TYPE: PAPER
      VERSION: "LATEST"
      MEMORY: "2G"
Bind mounts allow you to edit files locally and see changes immediately.

Production

docker-compose.yml
services:
  minecraft:
    image: itzg/minecraft-server:java21
    container_name: mc-prod
    ports:
      - "25565:25565"
    volumes:
      - mc-data:/data
    environment:
      EULA: "TRUE"
      TYPE: PAPER
      VERSION: "1.21.4"
      MEMORY: "8G"
      ENABLE_ROLLING_LOGS: "TRUE"
      TZ: "America/New_York"
      DIFFICULTY: "normal"
      MAX_PLAYERS: 50
      VIEW_DISTANCE: 10
      SIMULATION_DISTANCE: 8
    restart: unless-stopped
    stop_grace_period: 60s

volumes:
  mc-data:
    driver: local
Always pin specific versions in production to prevent unexpected updates.

Advanced Deployment Patterns

Auto-pause

Reduce resource usage when no players are online:
docker-compose.yml
services:
  minecraft:
    image: itzg/minecraft-server
    ports:
      - "25565:25565"
    volumes:
      - "mc:/data"
    environment:
      EULA: "TRUE"
      TYPE: PAPER
      ENABLE_AUTOPAUSE: "TRUE"
      MAX_TICK_TIME: "-1"
      AUTOPAUSE_TIMEOUT_INIT: "30"
      AUTOPAUSE_TIMEOUT_EST: "10"
      JVM_DD_OPTS: "disable.watchdog:true"
    restart: unless-stopped

volumes:
  mc: {}
See the full autopause example for detailed configuration.

With Proxy

Route traffic through a proxy server:
docker-compose.yml
services:
  mc:
    image: itzg/minecraft-server
    ports:
      - "25565:25565"
    environment:
      EULA: "TRUE"
      PROXY: proxy:3128
      
  proxy:
    image: sameersbn/squid

Multiple Mounts

Mount specific directories for better organization:
docker-compose.yml
services:
  minecraft:
    image: itzg/minecraft-server
    volumes:
      - ./data:/data
      - ./mods:/mods
      - ./config:/config
      - ./plugins:/plugins
    ports:
      - "25565:25565"
    environment:
      EULA: "true"
      TYPE: "FORGE"
      VERSION: "1.19.2"
    tty: true
    stdin_open: true

Deployment Best Practices

Use Named Volumes

Named volumes are managed by Docker and persist across container recreations

Pin Versions

Specify exact versions in production to prevent breaking changes

Configure Backups

Implement regular backup strategies for world data

Monitor Resources

Track CPU, memory, and disk usage to prevent performance issues

Set Restart Policies

Use unless-stopped for automatic recovery from failures

Use Health Checks

Implement health checks to detect server issues

Next Steps

Kubernetes Deployment

Deploy on Kubernetes with StatefulSets and Helm charts

Docker Swarm

Set up clustered deployments with Docker Swarm

More Examples

Explore additional deployment configurations and patterns

Additional Resources

Build docs developers (and LLMs) love