Added proper Fabric README

pull/3/head
Jef Roosens 2020-12-30 16:43:58 +01:00
parent 0ae84c0019
commit 9bb551601f
2 changed files with 25 additions and 56 deletions

View File

@ -24,6 +24,11 @@ package manager (do note that the Docker package might be called `docker.io`).
Otherwise, the install instructions can be found Otherwise, the install instructions can be found
[here](https://docs.docker.com/engine/install/). [here](https://docs.docker.com/engine/install/).
## Configuration
All configuration can be done using a `.env` file with a provided `.env.example`
file to start from. This means that you never have to edit the compose files,
unless you wish to deviate from the default format.
## Building the image ## Building the image
You can build the container image using the command `docker-compose build`. You can build the container image using the command `docker-compose build`.
This will build all services specified in the `docker-compose.yml` file. Any This will build all services specified in the `docker-compose.yml` file. Any

View File

@ -1,41 +1,32 @@
# docker-mc-fabric # Build arguments
This repository helps you easily setup a modded Minecraft server using the Only one build argument is required, namely `FABRIC_VERSION`. This is the
[Fabric mod loader](https://fabricmc.net/). version of Fabric you wish to install. You can find the list of versions
[here](https://fabricmc.net/use/). For example, you can then set
`FABRIC_VERSION=0.6.1.51` in the `.env` file.
## Installing docker # Environment variables
You can follow the instructions The two possible environment variables are `XMS` and `XMX`. These specify the
[here](https://docs.docker.com/engine/install/). initial RAM & maximum RAM usage, respectively. Only `XMS` is required; `XMX` is
just set to the same value as `XMS` if not specified. You must specify them as
a number, e.g. `XMS=4`. This number represents a quantity of gigabytes.
## Building the image # Mount points
To build the image, you must specify the Fabric version using the `VERSION` There a three useful mount points defined:
build argument. You can either do this using `docker`:
`docker build -t mc-fabric-server:latest --build-arg VERSION=0.6.1.51 .`
or using `docker-compose`, by specifying the argument in the
`docker-compose.yml` file and running:
`docker-compose build`
See the provided `docker-compose.yml` file for an example of how to specify the
build argument.
## Useful mount points
The container has three useful mount points:
* `/mc/config`: this is where all server config files reside. * `/mc/config`: this is where all server config files reside.
* `/mc/config/mods`: this is where all mods should be placed. * `/mc/config/mods`: this is where all mods should be placed.
* `/mc/worlds`: this is where the world files are stored. * `/mc/worlds`: this is where the world files are stored.
I recommend mounting these to either a local directory or a volume, as to not You can mount these directories somewhere in the host file system by specifying
lose the server data. the mount paths in the `.env` file. These can be both absolute or relative
paths.
## Environment variables # Other config variables
The container has two environment variables which can be set, namely `XMS` and The only other config variable is `PORT`. This specifies on what port your
`XMX`. If `XMX` is not set, it will use `XMS`'s value by default. Note that server will be discoverable over the internet. The default Minecraft port is
their value is expected to be an integer, which is then used as a quantity for `25565`.
gigabytes. Therefore, only gigabyte precision is possible.
## Java flags # Java flags
I use the Java flags defined I use the Java flags defined
[here](https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/). [here](https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/).
If you don't agree with this decision, you can change the `ENTRYPOINT` at the If you don't agree with this decision, you can change the `ENTRYPOINT` at the
@ -52,30 +43,3 @@ ENTRYPOINT java \
This will only use the flags absolutely necessary, while still allowing you to This will only use the flags absolutely necessary, while still allowing you to
tweak the memory variables. tweak the memory variables.
## Running the server
### docker
You can start the server with the following command:
```
docker run \
--rm \
--interactive \
--tty \
--publish '25565:25565' \
--detach \
mc-fabric-server:latest
```
Or, more compact:
`docker run --rm -dit -p '25565:25565' mc-fabric-server:latest`
This will start the server and run it in the background.
### docker-compose
If you prefer to use `docker-compose` (which I recommend), you can use the
provided `docker-compose.yml` file and edit it to suit your needs. By default,
it creates volumes for the three major mount points, and opens up port `25565`.
Then, you can start the server using `docker-compose up --detach` or
`docker-compose up -d`, because no one likes typing long commands.