Go to file
2022-06-14 14:33:13 -05:00
.dockerignore Testing an alternative approach to the CI 2021-05-22 00:07:13 -05:00
.gitignore Create gitignore 2021-02-16 12:18:56 -06:00
.gitlab-ci.yml Testing an alternative approach to the CI 2021-05-22 00:07:13 -05:00
build.sh Remove the JDK version and Forge version from our tags because we don't care about them 2022-06-14 13:59:11 -05:00
Dockerfile Actually wait let's reorder those args 2022-06-14 14:33:13 -05:00
LICENSE Add LICENSE 2022-05-17 10:59:40 -05:00
README.md Add link to DH in README 2022-05-17 11:34:13 -05:00
server.properties Initial test build. Looks like everything works 2021-04-09 16:28:17 -05:00
start-server.sh Ignore permissions on rsync 2022-06-14 14:10:39 -05:00

docker-minecraft

A Dockerfile and some assorted scripts to build a Minecraft Forge server container.

Usage

Deploy as expected:

docker run -p 25565:25565 rehashedsalt/minecraft-forge:1.16.5-36.2.35-openjdk11-jre-master

And badda bing, badda boom, you'll have a Minecraft Forge server of whatever the tag is.

The tag looks long and unweildy, but it's just this:

rehashedsalt/minecraft-forge:${MINECRAFT_VERSION}-${FORGE_VERSION}-${OPENJDK_VERSION}-${BRANCH_OR_TAG_NAME}

You can see what the supported combinations of tags are by looking them up in build.sh. Each version only supports one edition of Java and one edition of Forge. Getting CI/CD to automagically determine the latest version of Forge is on the to-do list.

Admittedly, I don't use tags very often. You'd do well to target master as the refname if you want bleeding edge stuff.

Full list of tags is available on Dockerhub.

Server Console

You can access the server console in a screen session pretty easily:

docker exec -it mycontainer screen -r minecraft

Application State

For obvious reasons, you'll want to consult the documentation of any mods you have installed, but a majority of application state lives here-ish:

  • /minecraft/world

  • /minecraft/ops.json, whitelist.json, banned-ips.json, banned-players.json, etc.

  • /minecraft/logs

Environment Variables

variable description
JRE_XMX Maximum amount of heap passed to the main Minecraft process
JRE_XMS Minimum heap size passed to the main Minecraft process
FORGE_PACK_ZIP If provided, the URL to a zip or tar.gz file that contains the modpack that needs to be installed. Will be intelligently extracted into the server directory through the magic of find.
CONFIG_REPO If provided, the URI to a git repository that contains configuration to copy over top the pack. The root of the repo will be the root of the server directory.
ARGS Any additional arguments to be passed to the JVM

Useful Arguments

The following arguments may be useful to pass through $ARGS from time to time:

  • -Dfml.queryResult=confirm - Useful when confirming through world corruption

  • Consider this advice from a Forge dev (circa 5+ years ago but still pretty relevant)

Weird Defaults

The default server.properties contains the following changes to better facilitate usage in a modded environment:

allow-flight=true
difficulty=hard
enable-command-block=true
spawn-protection=0

FAQ

Why do you download the pack at runtime?

It allows for transparent upgrades without having to build a whole new container. You may lose container consistency, but you gain simplicity in definition.

Of course, nothing prevents you from just not using this magic variable and instead FROMing this container and building your own pack.

License

MIT