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.
- Make - CLI to easily execute scripts given in the Makefile.
Read Minecraft's EULA and if you agree, run the convenient make agree-eula command.
All command references are found here, refer there for information about each command listed.
- Run the command
make server [MC version]to start your new minecraft server instance.
-
Run
make setup-env [MC Version]. -
Build the image that uses the setup env variables via command:
make buildmake rebuild
- Run
make upto start the minecraft instance.
Note: Command make image [MC Version] does steps 1 and 2 in one go.
- 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
- You can then
make uplater if you want to start the server up again. - 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. make serveris only needed when you want to host a different version or initial setup.- If you want to always have a clean server setup, run
make new-server [MC version]
- It is a good idea to backup the
out/worlddata incase you want to reload the world again. - You can look at MC versions via
make find [Query version]command or look at available_versions.csv - Try to
git pullif the newest server version is not supported.- 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.
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 using image base.
| Image Base | alpine | distroless |
|---|---|---|
| Distribution | alpine | debian |
| C Library | musl libc | glibc |
| Final Image Size | smaller | small |
Distroless: A custom-made image that mostly has the files needed to run the minecraft server.
- Bigger image due to
glibcand JRE being compiled withglibc. - Custom made from extracting files from
.debfiles.
Alpine: Its own linux distribution designed with a small image in mind.
- Uses
musl Cwhich uses less memory footprint but potentially less features that can support.
The distroless dockerfile setup is selected as default due to the glibc which is more commonly used.
If you want to try alpine, just go to the line where dockerfile: is located in docker-compose.yaml and change the extension from distroless to alpine.
All the commands grouped by intended functionality. Replace [MC Version] with your desired minecraft version.
make agree-eula- Inserts theeula.txtfile indicating you agree to the terms.make find [Query]- Search versions with matching[Query]that are available to use in place of[MC Version].make setup-env [MC Version]- Sets up environment variables for docker-compose.yaml to refer to.
- Do
make setup-envbefore doing the following commands:
make build- Builds the image using cached layers when possible to save time.make rebuild- Builds the image from scratch regardless of presence of cached layers.
- Bundled commands that you can run standalone:
make image [MC Version]- Runsmake setup-env [MC Version]and thenmake build.
- Do
make setup-envbefore doing the following commands:
make up- Launches the container based on the.envfile. Skips rebuilding image if it exists.
- Bundled commands that you can run standalone:
make server [MC Version]- Runsmake setup-env [MC Version]and thenmake up.make new-server [MC Version]- Starts up a new instance from fresh image build.
make down- Close the server.make out-clean- Clears theoutfolder leaving the eula and the.gitignorein place.make cleanDoesmake downand thenmake out-world.make resetCleans the project up. Only really use if no longer using this repository.
Surplus:
make image-clean- Clears the images made in this project assuming tag base names have not changed.
- 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.