This repository contains the setup for setting up a minecraft server without having to install your own version of Java. This setup only supports vanilla minecraft for the time being.
Setup includes the following:
- Selects the Java version appropriate for the server version.
- Downloads the correct server version for you, given availability.
- Gets you started straight to server setup.
- Docker - Needed for this setup. Great for quickly spinning up an environment for the server.
- Linux, Mac or WSL for Windows - Needed to use bash commands.
Optional:
Note: Main scripts will have you agree to Minecraft's EULA.
Each scripts have their dedicated help commands. Makefile has the make help command for their equivalents.
- Use the command
serverand then type your desired Minecraft version.
Re-running the same server again command is run-server.
- Run the command
make server [MC version]to start your new minecraft server instance.
Re-running the same server again command is make up
- You will be given direct access to the server CLI.
- Enter command
stopin the server CLI to close the server. Recommended for graceful exit. - You can alternatively use
Ctrl-Cbut generally not recommended.
- Enter command
- JVM arguments can be set in docker-compose.yaml file in the
commandline. - The server files will be populated in the
outfolder so that users can access them and backup anytime.- The
outfolder will initially not be there. It will be created before the server runs.
- The
- It is a good idea to backup the
out/worlddata incase you want to reload the world again. - Try to
git pullif the newest server version is not supported. - Type
git clean -fdto restore the project after tinkering. Does not remove contents fromoutdirectory.- There is a github action that auto-populates the server versions every 24 hours.
- Currently the docker setup does not support showing the GUI app generated from
server.jar, so including--noguiafter the jar file path is crucial.- Currently no plan to adding GUI support to containers due to current complexity.
- Requires different setup depending on OS.
WARNING: Not for those new to docker.
There is a build stage where only the JRE environment is made without downloading the server. Can be great for trying out other modded servers.
Note the instructions makes use of Makefile commands.
You can start up an instance by going to the existing docker-compose.yaml and change the following:
- Change the
targetvalue inbuildfromminecraft-servertoenv-base. - Run
make image [MC Version]to build env-base image. Excludes downloading theserver.jarfile. - Place the server JAR file in this directory. Recommended to rename the JAR file to
server.jar. - Uncomment the volume bind for the server JAR in the yaml file.
- Run
make upto start the container.
Disclaimer: Modded servers are not guaranteed to work with this setup as they may need extra JRE modules.
Currently there are two dockerfiles available for setup. They have extensions based on C library names.
Supported C libraries:
If you want to try musl, just create a file with the filename clib.env in this project directory and then paste the following text to the file:
C_LIB=muslYou can later either remove the file or change the value from musl to glibc if you want to go back to using glibc.
musl is only there for experimental purposes, glibc is recommended due to it being more fit for purpose for running minecraft servers and is the reason why it's currently set as the default in the docker-compose file.
Currently the image build can support standalone setup without any binding but is recommended to use the current docker compose setup as the mount setup is good in general use cases.
This setup as a hobby project to get to know docker more.
- Generate the
.envfile using the convenientmake setup-env [MC_VERSION]
Preparing the setup for building a standalone image:
In the docker-compose.yaml file:
- Uncomment the line where it says
MINECRAFT_EULA=TRUE. - Comment the line where it says
- ./out:/mnt/server-files/${UID:-65532}_${GID:-65532}.
Extra step for linux/mac users: Remove the variables UID and GID from the generated .env file.
- Run
docker compose buildto build the image.
The name of the image shown in the output should look something like minecraft.vanilla.server:glibc-1.21.11 assuming 1.21.11 is the MC_VERSION chosen.
- You can run the standalone container via the command:
docker run --rm -it -p 25565:25565 IMAGE_NAMEReplacing IMAGE_NAME with the name of the generated image.
- Mojang Studios for providing the server JARs and metadata.
- liebki's repo for reference to auto-update github action and having populated most server links.