01
Why use Docker
The itzg/minecraft-server image is an open-source project, widely used and documented in detail. On startup, it downloads the requested server itself, writes server.properties from your variables and starts Java with the memory you set. You install neither Java nor the server on the VPS: everything fits in one configuration file.
- Several servers on one machine, each isolated in its own container.
- Simple changes: switching version or software means editing one line.
- A suitable Java version, provided by the image.
You need a recent, secured Linux VPS (see secure a Linux VPS) with Docker and Docker Compose: follow install Docker on a VPS. If you prefer a web interface to follow containers, Portainer can read the same Compose file.
02
The compose.yaml file
Create a folder for the server, then the compose.yaml file:
mkdir -p ~/minecraft && cd ~/minecraft
nano compose.yaml
services:
mc:
image: itzg/minecraft-server
container_name: mc
tty: true
stdin_open: true
ports:
- "25565:25565"
environment:
EULA: "TRUE"
TYPE: "PAPER"
VERSION: "1.21.4"
MEMORY: "4G"
TZ: "Europe/Paris"
volumes:
- ./data:/data
restart: unless-stopped
EULA: required. By writing TRUE, you accept the Minecraft licence agreement; without it, the server does not start.
TYPE: the software. VANILLA by default, Mojang's official server; PAPER, PURPUR, FABRIC, FORGE or NEOFORGE for the others. The Paper, Purpur or Spigot guide helps you choose.
VERSION: the Minecraft version. LATEST by default, the latest stable version, downloaded at every start. Pin a precise version instead, as here: your plugins will not change version by surprise.
MEMORY: Java's memory, 1 GB by default. The Minecraft server RAM guide gives orders of magnitude.
./data:/data: the whole server (world, configuration, plugins) is written to the container's /data, so to the data folder on the VPS. That is the folder to back up.
tty and stdin_open: give the server an interactive console.
VPS memory. MEMORY only sets the Java heap. The image's documentation advises planning about 25 % more for the rest of the process, not counting the VPS system.
03
Start, follow and control the server
Start the server and follow its startup:
docker compose up -d
docker compose logs -f mc
The first time, the image downloads the server and generates the world; Ctrl+C leaves the log view without stopping the server. Players then connect with the VPS's IP address.
The console. The image enables RCON by default, with a randomly generated password, and ships the rcon-cli tool:
docker exec -i mc rcon-cli
docker exec mc rcon-cli op VotrePseudo
The first command opens an interactive console; the second sends a single command. You can also attach to the server console with docker attach mc, then detach without stopping it with Ctrl+P followed by Ctrl+Q. Useful commands are in Minecraft admin commands.
Ports. Do not publish the RCON port (25575): rcon-cli works from inside the container. Also note that Docker writes its own filtering rules before UFW's: a port published under ports is open to the Internet even if UFW blocks it.
04
Plugins, mods and settings
Plugins (Paper, Purpur) go in data/plugins, then restart with docker compose restart mc. The image can also download them itself: the PLUGINS variable takes a list of .jar file URLs, and MODRINTH_PROJECTS a list of Modrinth projects, picked in the version that matches TYPE and VERSION:
MODRINTH_PROJECTS: |
luckperms
Mods (Fabric, Forge, NeoForge) go in data/mods. With TYPE: "FABRIC", most mods require Fabric API: add fabric-api to MODRINTH_PROJECTS. Players must have the same mods (see install mods on a Minecraft server).
Server settings also go through variables: DIFFICULTY, MOTD, OPS, WHITELIST with ENABLE_WHITELIST, and many others listed in the image's documentation. A variable that is set rewrites the matching line of server.properties on startup; a missing variable leaves the line as it is. To manage the file entirely by hand, add OVERRIDE_SERVER_PROPERTIES: "false".
Older versions. The image's default tag provides a recent Java version. For an older Minecraft version, pick the matching Java tag in the documentation: for example itzg/minecraft-server:java8 for Forge before 1.18.
05
Updates, backups and several servers
Back up. The simplest way is to stop the server, archive the data folder, then start it again:
cd ~/minecraft
docker compose stop
sudo tar czf ~/mc-$(date +%F).tar.gz data
docker compose start
Then copy the archive off the VPS. For automatic backups without stopping, the same author publishes the itzg/mc-backup image, made for Java Edition: its documentation details the settings.
Update. For the image (Java and tools), run docker compose pull then docker compose up -d: the container is recreated, the world stays in data. For Minecraft, take a backup, change VERSION, check that your plugins follow, then run docker compose up -d again. A world opened with a newer version cannot go back: keep the archive.
Several servers. Add a second service to the file, with its own data folder and another port on the VPS side:
mc2:
image: itzg/minecraft-server
container_name: mc2
tty: true
stdin_open: true
ports:
- "25566:25565"
environment:
EULA: "TRUE"
TYPE: "FABRIC"
VERSION: "1.21.4"
MEMORY: "3G"
volumes:
- ./data2:/data
restart: unless-stopped
Players then add :25566 to the address. To receive everything on port 25565 and route players by the domain name they use, the same author offers itzg/mc-router. Add up the memory of all servers before adding one: the guide host several game servers gives the method.
06
On CloudFive
For Docker, the Ryzen VPS, from €5.99 per month, is a good fit:
- an AMD Ryzen 9 9950X, with DDR5 memory and NVMe storage;
- root access and a dedicated IPv4 address; Docker and Docker Compose install normally (see the Docker VPS page);
- basic anti-DDoS protection included, and Premium Protection, with a game-specific filter, as a paid option (see protect a game server against DDoS).
If you would rather not administer anything, our Minecraft hosting plans, from €8 per month, install Paper, Purpur, Fabric, Forge, NeoForge or a Modrinth modpack in one click, with Anti-DDoS Premium included, and the console, files (SFTP) and backups in the customer area. Both are in France, monthly with no commitment, with French-speaking support 7 days a week.
07
Frequently asked questions
How do I run a Minecraft server with Docker?
With the itzg/minecraft-server image: a compose.yaml file that sets EULA=TRUE, the TYPE (PAPER, FABRIC…), the VERSION and the MEMORY, publishes port 25565 and mounts a folder on /data. The docker compose up -d command downloads the server and starts it.
Why does the Docker Minecraft server not start?
Most often, the EULA variable is missing or not set to TRUE: without it, the server refuses to start. Read the logs with docker compose logs -f; a Java version error is fixed by choosing the image's matching Java tag.
How do I send commands to a Minecraft server in Docker?
The image enables RCON by default and ships rcon-cli: docker exec -i mc rcon-cli opens an interactive console, and docker exec mc rcon-cli followed by a command sends it directly. Do not publish the RCON port, the tool works from the container.
Can I run several Minecraft servers with Docker?
Yes. Each server gets its own service, its own data folder and a different port on the VPS side, for example 25566. To receive everything on port 25565 by domain name, the itzg/mc-router image acts as a router; add up the memory of all servers.
Docker or a ready-to-use Minecraft plan?
Docker on a VPS lets you control everything, but you must keep the system, the image and backups up to date. CloudFive's Minecraft plans install the server in one click, with the console, files, backups and Anti-DDoS Premium in the customer area.