This is docker java environment images of minecraft servers.
We packed MCDReforged too.
The docker repository is at https://hub.docker.com/r/craftmine/minecraft
-
Make sure Docker Cli is installed on the server.
-
Use tag to pull the environment that you want:
- Pure java:
docker pull craftmine/minecraft:java<java_version>
- MCDReforged:
craftmine/minecraft:java<java_version>-mcdr<mcdr_version>
- Pure java:
-
Use
docker run
ordocker create
to create the server. For example:docker run -it --rm -v "my-minecraft-server-volume":"/minecraft" craftmine/minecraft:java17-mcdr
Hints:
- You must run the server with a volume if you will remove the container. It will be safer than without a volume.
- If you don't need to attach the console, you can use
docker run
with-d
(detach) option - If you used
docker create
, you must usedocker start
later to start the server
-
Set up your minecraft server inside the container
Since Minecraft EULA, we can't pack minecraft server. You can download the server file from minecraft offical API (e.g. https://www.minecraft.net/en-us/download/server).
- For example, you can download the 1.19.2 server use the command below:
wget -O /minecraft/minecraft.jar https://piston-data.mojang.com/v1/objects/f69c284232d7c7580bd89a5a4931c3581eae1378/server.jar
- We also pre-installed minecraft server installer in newer images. It support install not only vanilla server, but also some popular servers (such as fabric, forge, spigot).
Do
minecraft_installer
in the container for more information. Example command (to install latest fabric server for mcdreforged):minecraft_installer -path /minecraft/server/ -name minecraft_server -server fabric -version latest
- For example, you can download the 1.19.2 server use the command below:
-
Sometimes you need to restart the docker containers, but you may just exit the init shell use
exit 0
and the server will be auto start -
Have fun :)