Skip to content

Intro

Docker Pulls Docker Stars GitHub Issues Discord Build and Publish Image

This docker image provides a Minecraft Server that will automatically download the latest stable version at startup. You can also run/upgrade to any specific version or the latest snapshot. See the Versions section below for more information.

To simply use the latest stable version, run

docker run -d -it -p 25565:25565 -e EULA=TRUE itzg/minecraft-server

where, in this case, the standard server port 25565 will be exposed on your host machine.

Persistent Data

The Minecraft server will store its data in the container's /data directory. This directory can be mounted from the host machine or a managed volume.

Using docker run add a -v option somewhere before the image name:

... -v /path/on/host:/data itzg/minecraft-server

Using docker compose, add a volumes section to the service definition:

services:
  mc:
    # ... image and environment section
    volumes:
      # attach the relative directory 'data' to the container's /data path
      - ./data:data

Note

If you plan on running a server for a longer amount of time it is highly recommended using a management layer such as Docker Compose or Kubernetes to allow for incremental reconfiguration and image upgrades.

Info

Be sure to always include -e EULA=TRUE in your commands and container definitions, as Mojang/Microsoft requires EULA acceptance.

By default, the container will download the latest version of the "vanilla" Minecraft: Java Edition server provided by Mojang. The VERSION and the TYPE can be configured to create many variations of desired Minecraft server.

Using Docker Compose

  1. Create a new directory
  2. Put the contents of the file below in a file called compose.yaml
  3. Run docker compose up -d in that directory
  4. Done! Point your client at your host's name/IP address and port 25565.
compose.yaml
services:
  mc:
    image: itzg/minecraft-server:latest
    pull_policy: daily
    tty: true
    stdin_open: true
    ports:
      - "25565:25565"
    environment:
      EULA: "TRUE"
    volumes:
      # attach the relative directory 'data' to the container's /data path
      - ./data:/data

To apply changes made to the compose file, just run docker compose up -d again.

Follow the logs of the container using docker compose logs -f, check on the status with docker compose ps, and stop the container using docker compose stop.

Configurator Tool

If you prefer to use an interactive tool to create or edit a Docker Compose file for this image, you can check out setupmc.com's configurator. It provides a form that supports most of the image variables and generates the compose.yaml file in real time.

More Compose Examples

There are more examples located in the Github repo.

Deployment Examples

The deployments page provides more examples of deployment with and beyond Docker Compose.