Minecraft servers in Docker
Tip
When creating your Docker Compose or starting the server, use a supported version as the `image` tag. Like `myferr/mc-server:1.21.6`, `myferr/mc-server:1.20.6`, `myferr/mc-server:1.19.4`, etc.
docker run -d -p 25565:25565 --name mc-server myferr/mc-server:1.21.6
services:
mc-server:
image: myferr/mc-server:1.21.6
container_name: mc-server
ports:
- "25565:25565"
Start the server:
docker compose up -d
You can configure the Minecraft server through environment variables in either docker run or docker-compose.yml.
| Variable | Values (examples) | Default | Description |
|---|---|---|---|
DIFFICULTY | peaceful, easy, normal, hard | easy | Sets the difficulty level of the world. |
MOTD | Any string (e.g. "Hello World!") | "Welcome to my server!" | Message shown in the server list (supports formatting codes). |
GAMEMODE | survival, creative, adventure, spectator | survival | Sets the default gamemode for new players. |
HARDCORE | true, false | false | Enables or disables hardcore mode. |
A Minecraft server icon is a visual representation of the game's logo or a custom design that can be used to identify the server in the server list, to apply the logo to the server just by placing it in the server-icon.png file in the server directory. Make sure it's a .png and a 64x64 pixel size.
To apply a server icon in your Docker Compose add the following lines:
volumes:
- ~/desktop/server-icon.png:/server/server-icon.png
Full example:
services:
mc-server:
image: myferr/mc-server
container_name: mc-server
ports:
- "25565:25565"
volumes:
- ~/desktop/server-icon.png:/server/server-icon.png
docker run -d -p 25565:25565 \
-e MOTD="Welcome to my server!" \
-e DIFFICULTY=normal \
-e GAMEMODE=survival \
-e HARDCORE=false \
myferr/mc-server:latest
services:
mc-server:
image: myferr/mc-server:latest
ports:
- "25565:25565"
environment:
- DIFFICULTY=normal
- MOTD=Welcome to my server!
- GAMEMODE=survival
- HARDCORE=false
| Version | Supported? |
|---|---|
1.21.8 | ✅ |
1.21.7 | ✅ |
1.21.6 | ✅ |
1.21.5 | ✅ |
1.21.4 | ✅ |
1.21.3 | ✅ |
1.21.2 | ✅ |
1.21.1 | ✅ |
1.21 | ✅ |
1.20.6 | ✅ |
1.20.5 | ✅ |
1.20.4 | ✅ |
1.20.3 | ✅ |
1.20.2 | ✅ |
1.20.1 | ✅ |
1.20 | ✅ |
1.19.4 | ✅ |
1.19.3 | ✅ |
1.19.2 | ✅ |
1.19.1 | ✅ |
1.19 | ✅ |
1.18.2 | ✅ |
1.18.1 | ✅ |
1.18 | ✅ |
1.17.1 | ✅ |
1.17 | ✅ |
1.16.5 | ✅ |
1.16.4 | ✅ |
1.16.3 | ✅ |
1.16.2 | ✅ |
1.16.1 | ✅ |
1.16 | ✅ |
1.15.2 | ✅ |
1.15.1 | ✅ |
1.15 | ✅ |
1.14.4 | ✅ |
1.14.3 | ✅ |
1.14.2 | ✅ |
1.14.1 | ✅ |
1.14 | ✅ |
1.13.2 | ✅ |
1.13.1 | ✅ |
1.13 | ✅ |
1.12.2 | ✅ |
1.12.1 | ✅ |
1.12 | ✅ |
1.11.2 | ✅ |
1.11.1 | ✅ |
1.11 | ✅ |
1.10.2 | ✅ |
1.10.1 | ✅ |
1.10 | ✅ |
1.9.4 | ✅ |
1.9.3 | ✅ |
1.9.2 | ✅ |
1.9.1 | ✅ |
1.9 | ✅ |
1.8.9 | ✅ |
1.8.8 | ✅ |
1.8.7 | ✅ |
1.8.6 | ✅ |
1.8.5 | ✅ |
1.8.4 | ✅ |
1.8.3 | ✅ |
1.8.2 | ✅ |
1.8.1 | ✅ |
1.8 | ✅ |
This project is licensed under the MIT license and is completely open-source.
Content type
Image
Digest
sha256:4206b97f4…
Size
94.5 MB
Last updated
8 months ago
docker pull myferr/mc-server