
- ``` sh
- docker run -d -it -p 25565:25565 -e EULA=TRUE itzg/minecraft-server
- ```
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.
Be sure to always include -e EULA=TRUE in your commands and container definitions, as Mojang/Microsoft requires EULA acceptance.
DO NOTport forward RCON on 25575 without first setting RCON_PASSWORD to a secure value. It is highly recommended to only use RCON within the container, such as with rcon-cli.
Looking for a Bedrock Dedicated Server
Interacting with the server
- ``` sh
- docker exec -i mc rcon-cli
- ```
- ``` sh
- docker exec mc rcon-cli stop
- ```
- ``` shell
- docker exec mc mc-send-to-console op player
- | |
- +- container name +- Minecraft commands start here
- ```
- ``` sh
- docker run -d -it -p 25565:25565 --name mc itzg/minecraft-server
- ```
- ``` sh
- docker attach mc
- ```
- ``` sh
- docker -H $HOST:2375 attach mc
- ```
Data Directory

NOTE: The container path /data is pre-declared as a volume, so if you do nothing then it will be allocated as an anonymous volume. As such, it is subject to removal when the container is removed.
Attaching data directory to host filesystem
- ``` sh
- -v /home/user/minecraft-data:/data
- ------------------------- -----
- | |
- | +-- must always be /data
- |
- +-- replace with a directory on your host machine
- ```
- ``` yaml
- version: "3"
- services:
- mc:
- image: itzg/minecraft-server
- ports:
- - 25565:25565
- environment:
- EULA: "TRUE"
- tty: true
- stdin_open: true
- restart: unless-stopped
- volumes:
- # attach a directory relative to the directory containing this compose file
- - ./minecraft-data:/data
- ```
NOTE: if you have SELinux enabled, then you might need to add :Z to the end of volume mount specifications, as described here.
Converting anonymous /data volume to named volume
In this example, it is assumed the original container was given a --name of "mc", so change the container identifier accordingly.
You can also locate the Docker-managed directory from the Source field obtained from docker inspect <container id or name> -f "{{json .Mounts}}"
- ``` shell
- docker stop mc
- ```
- ``` shell
- docker run --rm --volumes-from mc -v mc:/new alpine cp -avT /data /new
- ```
- ``` shell
- docker run -d -it --name mc-new -v mc:/data -p 25565:25565 -e EULA=TRUE -e MEMORY=2G itzg/minecraft-server
- ```
Locating filesystem path of anonymous volume
- ``` shell
- docker inspect -f "{{json .Mounts}}" CONTAINER_NAME_OR_ID
- ```
NOTEOn Windows with WSL the volumes path is \\wsl$\docker-desktop-data\data\docker\volumes
Versions
- ``` sh
- docker run -d -e VERSION=SNAPSHOT ...
- ```
- ``` sh
- docker run -d -e VERSION=1.7.9 ...
- ```
Running Minecraft server on different Java version
For Forge versions less than 1.18, you mustuse the java8-multiarch (or other java8) image tag.
| Tag name | Java version | Linux | JVM Type | Architecture |
|---|---|---|---|---|
| :--- | :--- | :--- | :--- | :--- |
| latest | 17 | Ubuntu | Hotspot | amd64,arm64,armv7 |
| java8 | 8 | Alpine | Hotspot | amd64 |
| java8-jdk | 8 | Ubuntu | Hotspot+JDK | amd64 |
| java8-multiarch | 8 | Ubuntu | Hotspot | amd64,arm64,armv7 |
| java8-openj9 | 8 | Debian | OpenJ9 | amd64 |
| java8-graalvm-ce | 8 | Oracle | GraalVM CE | amd64 |
| java11 | 11 | Ubuntu | Hotspot | amd64,arm64,armv7 |
| java11-jdk | 11 | Ubuntu | Hotspot+JDK | amd64,arm64,armv7 |
| java11-openj9 | 11 | Debian | OpenJ9 | amd64 |
| java17 | 17 | Ubuntu | Hotspot | amd64,arm64,armv7 |
| java17-jdk | 17 | Ubuntu | Hotspot+JDK | amd64,arm64,armv7 |
| java17-openj9 | 17 | Debian | OpenJ9 | amd64 |
| java17-graalvm-ce | 17 | Oracle | GraalVM CE | amd64,arm64 |
| java17-alpine | 17 | Alpine | Hotspot | amd64 |
| java20-alpine | 19 | Alpine | Hotspot | amd64 |
| java20 | 19 | Ubuntu | Hotspot | amd64,arm64,armv7 |
- ``` sh
- docker run --name mc itzg/minecraft-server:java8-multiarch
- ```
Keep in mind that some versions of Minecraft server, such as Forge before 1.17, can't work on the newest versions of Java. Instead, one of the Java 8 images should be used. Also, FORGE doesn't support openj9 JVM implementation.
Deprecated Image Tags
Related Projects
itzg/minecraft-bedrock-server
mc-router
itzg/bungeecord
itzg/mc-backup
rcon-cli
mc-monitor
mc-image-helper
itzg/rcon
Healthcheck
- ``` sh
- CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
- b418af073764 mc "/start" 43 seconds ago Up 41 seconds (healthy) 0.0.0.0:25565->25565/tcp, 25575/tcp mc
- ```
- ``` sh
- > docker container inspect -f "{{.State.Health.Status}}" mc
- healthy
- ```
- ``` yaml
- healthcheck:
- test: mc-health
- start_period: 1m
- interval: 5s
- retries: 20
- ```
Deployment Templates and Examples
Helm Charts
Examples
Amazon Web Services (AWS) Deployment
Using Docker Compose
- ``` yaml
- version: "3"
- services:
- mc:
- image: itzg/minecraft-server
- ports:
- - 25565:25565
- environment:
- EULA: "TRUE"
- tty: true
- stdin_open: true
- restart: unless-stopped
- ```
- ``` sh
- docker-compose up -d
- ```
Troubleshooting
Server types
Running a Forge Server
- ``` sh
- docker run -d -v /path/on/host:/data \
- -e TYPE=FORGE \
- -e VERSION=1.12.2 -e FORGE_VERSION=14.23.5.2854 \
- -p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
- ```
- ``` sh
- docker run -d -v /path/on/host:/data ... \
- -e FORGE_INSTALLER=forge-1.11.2-13.20.0.2228-installer.jar ...
- ```
- ``` sh
- docker run -d -v /path/on/host:/data ... \
- -e FORGE_INSTALLER_URL=http://HOST/forge-1.11.2-13.20.0.2228-installer.jar ...
- ```
If an error occurred while installing Forge, it might be possible to resolve by temporarily setting FORGE_FORCE_REINSTALL to "true". Be sure to remove that variable after successfully starting the server.
Running a Fabric Server
- ``` sh
- docker run -d -v /path/on/host:/data \
- -e TYPE=FABRIC \
- -p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
- ```