Sign inSign up

rdall96/minecraft-server

By rdall96

Updated 2 days ago

Ready to use Minecraft server images!

Image
Web servers
1

10K+

rdall96/minecraft-server repository overview

Minecraft Server - Docker

minecraft-docker-logo

Project Repository

This docker image based on Alpine Linux contains the necessary components to run a Minecraft server. The project supports the following Minecraft versions:


Installation

Pull the image to your local machine with:

docker pull rdall96/minecraft-server:latest

Note

The Docker tags indicate the Minecraft type and version. For example, to play vanilla Minecraft 1.20.1 (java), use the tag `1.20.1`. The `latest` tag will always track the newest vanilla Minecraft Java version. For other types of Minecraft (modded or bedrock) the respective game version will have the type appended to it. i.e.: `1.20.1-fabric_0.14.21`, `latest-bedrock`, `1.19.2-bedrock`. Modded Minecraft doesn't have a latest tag, since mods can take some time to update, it's not safe to keep updating the image.

Start a new container:

docker run -d --name minecraft -p 25565:25565 -e EULA=true rdall96/minecraft-server:latest

The new server will be running at localhost:25565 or <your-ip-address-here>:25565. For access outside your home network you need to open a port on your router. It is strongly encouraged to setup DDNS (Dynamic DNS) to link your public IP to a domain name, so you don't get disconnected or loose access if your IP changes.

Warning

A note regarding port forwarding. Opening ports on your network can be unsafe and expose you to malicious attacks, please proceed with caution and keep in mind there is a risk involved with it. This project's only goal is to run a Minecraft server, it and its owners are not responsible for any damage caused to you due to its usage with port forwarding.

Customization

World data

You can map the container path to the world file to a local directory on your system (or a Docker volume) in order to persist the data throughout server restarts and updates on a location of your choosing. To do so, just simply add this to your docker run command: -v <host-path>:/minecraft/world.

Complete example mapping the world data to a directory on your desktop:

docker run -d --name minecraft \
    -v ~/Desktop/minecraft:/minecraft/world \
    -p 25565:25565 \
    -e EULA=true \
    rdall96/minecraft-server:latest

For modded versions of Minecraft, you will likely want to map more folders to volumes like mods folders, or other configs. All the Minecraft server files can be found in the image at /minecraft, so for example the mods folder can be found at /minecraft/mods`.

If you're setting server operators (ops), a server whitelist, and/or banning players and want to persist those configurations on your local file system, map the /minecraft/configurations directory. Here's an example with the white list enabled and the configuration mapped to a local directory:

docker run -d --name minecraft \
    -v ~/Desktop/minecraft/world:/minecraft/world \
    -v ~/Desktop/minecraft/configurations:/minecraft/configurations \
    -p 25565:25565 \
    -e EULA=true \
    -e WHITE_LIST=true \
    rdall96/minecraft-server:latest

The /minecraft/configurations directory will contain files for the JSON configurations (i.e.: whitelist.json), as well as the legacy text format (.txt). For more information consult the guide in the README that is generated in that directory upon starting the server.

Server properties

There are a number of environment variables you can pass to your container in order to customize the server.properties file associated with a Minecraft server. Below is a complete list.

server.propertyNameValuesDefaultDescription
allow-flightALLOW_FLIGHTtrue, falsefalseAllows users to use flight on the server while in Survival mode, if they have a mod that provides flight installed
allow-netherALLOW_NETHERtrue, falsetrueAllows players to travel to the Nether
difficultyDIFFICULTYpeaceful, easy, normal, hardeasyDefines the difficulty (such as damage dealt by mobs and the way hunger and poison affects players) of the server
enable-command-blockENABLE_COMMAND_BLOCKtrue, falsefalseEnables command blocks
enable-statusENABLE_STATUStrue, falsetrueMakes the server appear as "online" on the server list
enable-queryENABLE_QUERYtrue, falsefalseEnables GameSpy4 protocol server listener. Used to get information about server
enforce-secure-profileENFORCE_SECURE_PROFILEtrue, falsetrueIf set to true, players without a Mojang-signed public key will not be able to connect to the server
gamemodeGAMEMODEsurvival, creative, adventure, spectatorsurvivalDefines the mode of gameplay
generate-structuresGENERATE_STRUCTUREStrue, falsetrueDefines whether structures (such as villages) can be generated
hardcoreHARDCOREtrue, falsefalseIf set to true, server difficulty is ignored and set to hard and players are set to spectator mode if they die
hide-online-playersHIDE_ONLINE_PLAYERStrue, falsefalseIf set to true, a player list is not sent on status requests
level-seedLEVEL_SEED(any string)(empty)Sets a world seed for the player's world, as in single player. The world generates with a random seed if left blank
level-typeLEVEL_TYPE(any string)minecraft:normalDetermines the world preset that is generated
max-playersMAX_PLAYERS(any number)20The maximum number of players that can play on the server at the same time. Note that more players on the server consume more resources
motdMOTD(any string)(empty)This is the message that is displayed in the server list of the client, below the name
online-modeONLINE_MODEtrue, falsetrueServer checks connecting players against Minecraft account database. Set this to false only if the player's server is not connected to the Internet.
op-permission-levelOP_PERMISSION_LEVEL(number 0-4)4Sets the default permission level for ops when using /op.
player-idle-timeoutPLAYER_IDLE_TIMEOUT(any number, in minutes)0 (disabled)If non-zero, players are kicked from the server if they are idle for more than that many minutes
pvpPVPtrue, falsetrueEnable PvP (player-vs-player) on the server
resource-packRESOURCE_PACK(any string)(empty)Optional URI to a resource pack. The player may choose to use it.
resource-pack-promptRESOURCE_PACK_PROMPT(any string)(empty)Optional, adds a custom message to be shown on resource pack prompt when require-resource-pack is used.
require-resource-packREQUIRE_RESOURCE_PACKtrue, falsefalseWhen this option is enabled (set to true), players will be prompted for a response and will be disconnected if they decline the required pack.
simulation-distanceSIMULATION_DISTANCE(any number between 3-32)10Sets the maximum distance from players that living entities may be located in order to be updated by the server, measured in chunks in each direction of the player (radius, not diameter)
spawn-animalsSPAWN_ANIMALStrue, falsetrueDetermines whether animals can spawn
spawn-monstersSPAWN_MONSTERStrue, falsetrueDetermines whether monsters can spawn
spawn-npcsSPAWN_NPCStrue, falsetrueDetermines whether villagers can spawn
spawn-protectionSPAWN_PROTECTION(any number)16Determines the side length of the square spawn protection area as 2x+1. Setting this to 0 disables the spawn protection
view-distanceVIEW_DISTANCE(any number)10Sets the amount of world data the server sends the client, measured in chunks in each direction of the player (radius, not diameter)
white-listWHITE_LISTtrue, falsefalseEnables a whitelist on the server

For more details and information regarding each of the properties above, please consult the Minecraft wiki on server properties

Any of these environment variables can be passed to the docker start container command with the argument -e <NAME>=<VALUE>. If you're using a lot of these properties, you want to consider passing Docker an environment file instead. This file is stored on your system and it lists all the of properties neatly in one place. You can an environment file to Docker using the flag --env-file <file-path>.

For example, here's the contents of an environment file stored at path ~/minecraft_server/properties.env on the host computer.

EULA=true
MOTD=Hello from Docker!
DIFFICULTY=hard
MAX_PLAYERS=5
WHITELIST=true

This file can then be used to start the Minecraft server as follows:

docker run -d --name minecraft \
    -v ~/Desktop/minecraft:/minecraft/world \
    -p 25565:25565 \
    --env-file ~/minecraft_server/properties.env \
    rdall96/minecraft-server:latest
Server arguments

You can specify additional Minecraft server (or mod loader) arguments by adding them to the docker command to create the container. For example, docker run rdall96/minecraft-server:latest --help, will print out all the server CLI options and quit.

JVM Properties

You can customize the JVM runtime using JVM args. Add your args to the jvm_args.txt file in the server configurations directory (/minecraft/configurations in the container, or use the default mapped volume). For example, an argument you may want to specify is the maximum Java memory for the Minecraft server. i.e.: Add -Xmx8G in that file to allow the server to use up to 8GB of RAM. All arguments in this file are forwarded to the java process used to run the Minecraft server. You can add -XX:+PrintFlagsFinal to log all of the JVM parameters at startup.


Issues

All users are encouraged to report any issues they might run into or suggestions that would improve the experience of using this docker container. Simply send an email to Minecraft Docker - Support.

Tag summary

Content type

Image

Digest

sha256:e2dc1f16c

Size

144.5 MB

Last updated

6 days ago

docker pull rdall96/minecraft-server