Also
* upgrade mc-monitor to Go 1.20.10
* upgrade restify to use Go 1.20.10
* upgrade rcon-cli to use Go 1.20.10
* upgrade mc-server-runner to use Go 1.20.10
* adding major version for pufferfish
* fixing test as well as fixing a quote that was added due to linter recommendation
* Changing get major version to using a simple cut command
Co-authored-by: christopher blodgett <christopher.blodgett@gmail.com>
* Fix for Random forge api failure, removing dependency duplication messages
* pushing array test for review
* Fixing while loops that were causing downloaded modids to reset
Co-authored-by: christopher blodgett <christopher.blodgett@gmail.com>
* Cherry-pick: Fixing AUTOPAUSE on Raspberry Pi 4s (#708)
* implement autopause interface selection
* concentrate ps calls in function file
* wording and add note about PAPER's etc watchdogs
* Replacing killall with pkill and ps -a to ps -ax
* Adding net-tools and removing -q from pkill
* Missed the resume.sh
* Christ there's a lot of ps calls
* Adding -x to health.sh, replacing killall with pkill in sudoers-mv, and replacing su-exec with gosu in knockd-config.cfg
Co-authored-by: sean.sullivan.ctr@progeny.net <sean.sullivan.ctr@progeny.net>
* Adds EULA to the 'quickstart' command in readme
most people will start with the quickstart command, which won't work anymore now that EULA is required. Modified the sample quickstart to include the new minimum params.
* Update README.md
Co-authored-by: Geoff Bourne <itzgeoff@gmail.com>
* Update README.md
Co-authored-by: Geoff Bourne <itzgeoff@gmail.com>
Co-authored-by: Geoff Bourne <itzgeoff@gmail.com>
* Only write EULA when it's set to `TRUE`
- This prevents a false value to be written while not being able to correct it afterwards using the environment variable.
* Convert EULA value to upper case to allow lower case `true` as value
Fabric's installer uses `-mcversion` to specify the Minecraft version (https://fabricmc.net/wiki/install). The way the command is written right now it will always use the latest version of MC and ignore the `VERSION` specification.
* feat(minecraft-server): add onbuild trigger
Added a ONBUILD trigger for the [ToF-BuildTools](https://git.faldoria.de/tof/server/build-tools).
If a plugins.yml is provided the BuildTools will download all plugins configured in the YAML.
https://github.com/itzg/dockerfiles/issues/218
* feat(minecraft-server): add arg for build output
* fix(minecraft-server): syntax error in Dockerfile
* fix(minecraft-server): chown jar files after building
* feat(minecraft-server): cleanup buildtools after using
* fix(minecraft-server): remove /plugins volume
The /plugins volume causes weird behaviour when prepolulating it with
files on build. Removing it as an explicit volume fixes that.
* mc: add example Dockerfile for ToF builds
* docs(minecraft-server): add docs for new onbuild trigger
* fix(minecraft-server): use correct url for build tools download
Regarding the minecraft-server image
The start script currently does not pass command line arguments to the next script. This makes it so server admins can't easily update their server to 1.13.2 by passing --forceUpgrade as an extra parameter after specifying the docker image. With this change it works as intended.
Proof that the arguments did not get added before and do now:
* Add this line to the start-minecraftFinalSetup script: `echo "Running with: mc-server-runner ${bootstrapArgs} java $JVM_XX_OPTS $JVM_OPTS -jar $SERVER ""$@"" $EXTRA_ARGS"`
* Build the image
* Run the image with extra arguments `--test`
* See this printed: `Running with: mc-server-runner -jar minecraft_server.1.13.2.jar`
* Update to this PR
* Build the image
* See this printed: `Running with: mc-server-runner -jar minecraft_server.1.13.2.jar --test`
Do this to allow write access for groups that the minecraft user is in.
This commit also fixes an issue if a group is specified with $GID and it has
no write access in the mounted host volume.
This was added such that Sponge servers are supported.
(For Sponge: TYPE=FORGE, MODPACK=[zip including sponge plugins and jar], MODCONFIG=[sponge configuration])
The sed command `sed -i "/gamemode\s*=/ c gamemode=$MODE" $SERVER_PROPERTIES` matches all lines containing `gamemode=`.
This includes the line `force-gamemode` that is set it with `setServerProp "force-gamemode" "$FORCE_GAMEMODE"`
So basically the `force-gamemode` line is erased and the `gamemode=value` line is duplicated, and then the server cleans it up at start and deduplicates the `gamemode` line and create a new `force-gamemode` line with a default value.
This fix ensures that only the `gamemode=` line is modified when changing the gamemode value.
1. Do you just have a question about something? If so, asking in the [Q&A Discussions](https://github.com/itzg/docker-minecraft-server/discussions/categories/q-a) or asking on [the Discord server](https://discord.gg/DXfKpjB) would be best.
2. Did you **re-pull the newest image** and confirmed the issue after that? Run `docker pull <image>` or if using a compose file, it's as easy as running `docker compose pull`. If using Kubernetes, add `imagePullPolicy: Always` to the container.
4. Is this bug happening after the `[init]` prefixed logs and after the log that says "Starting the Minecraft server"? If so, please report the bug with Mojang or the respective server provider.
5. Are you seeing a performance problem? If so, that is typically outside the scope of this image. Ask a question as above or contact the respective server provider.
- type:textarea
id:problem
attributes:
label:Describe the problem
validations:
required:true
- type:textarea
id:container
attributes:
label:Container definition
description:Please provide the compose file or run command used to create the container
value:|
```
Paste run command or compose file here
```
- type:textarea
id:logs
attributes:
label:Container logs
description:|
Please provide container logs from the start of the container, which will be the ones prefixed with `[init]`. It is even better if you can set the variable `DEBUG` to "true" and provide those debug container logs.
Thanks for taking the time to request an enhancement.
Even if you plan on submitting a pull request with a contributed enhancement it is best to describe the enhancement here first. Somebody might already be working on a similar thing and could use your help.
[](https://github.com/itzg/docker-minecraft-server/actions/workflows/build-multiarch.yml)
- [Quick start with Docker Compose](https://docker-minecraft-server.readthedocs.io/en/latest/#using-docker-compose)
- Running [different versions of Minecraft](https://docker-minecraft-server.readthedocs.io/en/latest/versions/minecraft/) and using [various server types](https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/) for Java Edition
- [Setting server properties via container environment variables](https://docker-minecraft-server.readthedocs.io/en/latest/configuration/server-properties/)
- [Managing mods and plugins with automated downloads and cleanup](https://docker-minecraft-server.readthedocs.io/en/latest/mods-and-plugins/)
- [Using various modpack providers/platforms](https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/)
- ...and much more
### Discontinued
There are also many examples located in [the examples directory](examples) of this repo.
##### Cassandra
I have found the [official image](https://hub.docker.com/_/cassandra/) to be quite sufficient
This image only supports Java edition natively; however, if looking for a server that is compatible with Bedrock edition, then use [itzg/minecraft-bedrock-server](https://github.com/itzg/docker-minecraft-bedrock-server) or [refer to this section](https://docker-minecraft-server.readthedocs.io/en/latest/misc/examples/#bedrock-compatible-server) to add Bedrock compatibility to a Java edition server.
[RCON](http://wiki.vg/RCON) is enabled by default, so you can `exec` into the container to
access the Minecraft server console:
```
docker exec -i mc rcon-cli
```
Note: The `-i` is required for interactive use of rcon-cli.
To run a simple, one-shot command, such as stopping a Minecraft server, pass the command as arguments to `rcon-cli`, such as:
```
docker exec mc rcon-cli stop
```
_The `-i` is not needed in this case._
## When RCON is disabled
If rcon is disabled you can send commands by passing them as arguments to the packaged `mc-send-to-console` script after setting the env var `CREATE_CONSOLE_IN_PIPE` to "true". For example, a player can be op'ed in the container `mc` with:
```shell
docker exec --user 1000 mc mc-send-to-console op player
||
+- container name +- Minecraft commands start here
```
## Enabling interactive console
In order to attach and interact with the Minecraft server make sure to enable TTY and keep stdin open.
!!! example
With `docker run` use the `-it` arguments:
```shell
docker run -d -it -p 25565:25565 --name mc itzg/minecraft-server
```
or with a compose file:
```yaml
services:
minecraft:
stdin_open: true
tty: true
```
With that you can attach and interact at any time using the following, replacing the `{...}` placeholders.
...when container is created with `docker run`
```
docker attach {container name or ID}
```
...or when declared using a compose file
```
docker compose attach {service name}
```
and then Control-p Control-q to **detach**.
!!! info "RCON is required for fully interactive, color console"
RCON must be enabled, which is the default, in order to use a fully interactive console with auto-completion and colorized log output.
RCON commands can be configured to execute when the server starts, a client connects, or a client disconnects.
!!! note
When declaring several commands within a compose file environment variable, it's easiest to use YAML's `|-` [block style indicator](https://yaml-multiline.info/).
**On Server Start:**
``` yaml
RCON_CMDS_STARTUP: |-
gamerule doFireTick false
pregen start 200
```
**On Client Connection:**
``` yaml
RCON_CMDS_ON_CONNECT: |-
team join New @a[team=]
```
**Note:**
* On client connect we only know there was a connection, and not who connected. RCON commands will need to be used for that.
**On Client Disconnect:**
``` yaml
RCON_CMDS_ON_DISCONNECT: |-
gamerule doFireTick true
```
**On First Client Connect**
``` yaml
RCON_CMDS_FIRST_CONNECT: |-
pregen stop
```
**On Last Client Disconnect**
``` yaml
RCON_CMDS_LAST_DISCONNECT: |-
kill @e[type=minecraft:boat]
pregen start 200
```
**Example of rules for new players**
Uses team NEW and team OLD to track players on the server. So move player with no team to NEW, run a command, move them to team OLD.
Sometimes you have mods or plugins that require configuration information that is only available at deploy-time. For example if you need to configure a plugin to connect to a database, you don't want to include this information in your Git repository or Docker image.
Or maybe you have some runtime information like the server name that needs to be set in your config files after the container starts.
For those cases there is the option to replace defined variables inside your configs with environment variables defined at container runtime.
When the environment variable `REPLACE_ENV_IN_PLACE` is set to `true` (the default), the startup script will go through all files inside the container's `/data` path and replace variables that match the container's environment variables. Variables can instead (or in addition to) be replaced in files sync'ed from `/plugins`, `/mods`, and `/config` by setting `REPLACE_ENV_DURING_SYNC` to `true` (defaults to `false`).
Variables that you want to replace need to be declared inside curly brackets and prefixed with a dollar sign, such as `${CFG_YOUR_VARIABLE}`, which is same as many scripting languages.
You can also change `REPLACE_ENV_VARIABLE_PREFIX`, which defaults to "CFG_", to limit which environment variables are allowed to be used. For example, with "CFG_" as the prefix, the variable `${CFG_DB_HOST}` would be substituted, but not `${DB_HOST}`. The prefix can be set to an empty string to allow for matching any variable name.
If you want to use a file's content for value, such as when using secrets mounted as files, declare the placeholder named like normal in the file and declare an environment variable named the same but with the suffix `_FILE`.
For example, a `my.cnf` file could contain:
```
[client]
password = ${CFG_DB_PASSWORD}
```
...a secret declared in the compose file with:
```yaml
secrets:
db_password:
external:true
```
...and finally the environment variable would be named with a `_FILE` suffix and point to the mounted secret:
```yaml
environment:
CFG_DB_PASSWORD_FILE:/run/secrets/db_password
```
Variables will be replaced in files with the following extensions:
Here is a full example where we want to replace values inside a `database.yml`.
```yml
---
database:
host:${CFG_DB_HOST}
name:${CFG_DB_NAME}
password:${CFG_DB_PASSWORD}
```
This is how your `docker-compose.yml` file could look like:
```yml
# Other docker-compose examples in /examples
services:
minecraft:
image:itzg/minecraft-server
ports:
- "25565:25565"
volumes:
- "mc:/data"
environment:
EULA:"TRUE"
ENABLE_RCON:"true"
RCON_PASSWORD:"testing"
RCON_PORT:28016
# enable env variable replacement
REPLACE_ENV_VARIABLES:"TRUE"
# define an optional prefix for your env variables you want to replace
ENV_VARIABLE_PREFIX:"CFG_"
# and here are the actual variables
CFG_DB_HOST:"http://localhost:3306"
CFG_DB_NAME:"minecraft"
CFG_DB_PASSWORD_FILE:"/run/secrets/db_password"
volumes:
mc:
rcon:
secrets:
db_password:
file:./db_password
```
## Patching existing files
JSON path based patches can be applied to one or more existing files by setting the variable `PATCH_DEFINITIONS` to the path of a directory that contains one or more [patch definition json files](https://github.com/itzg/mc-image-helper#patchdefinition) or a [patch set json file](https://github.com/itzg/mc-image-helper#patchset).
The `file` and `value` fields of the patch definitions may contain `${...}` variable placeholders. The allowed environment variables in placeholders can be restricted by setting `REPLACE_ENV_VARIABLE_PREFIX`, which defaults to "CFG_".
The following example shows a patch-set file where various fields in the `paper.yaml` configuration file can be modified and added:
By default, the image declares an initial and maximum Java memory-heap limit of 1 GB. There are several ways to adjust the memory settings:
-`MEMORY`: "1G" by default, can be used to adjust both initial (`Xms`) and max (`Xmx`) memory heap settings of the JVM
-`INIT_MEMORY`: independently sets the initial heap size
-`MAX_MEMORY`: independently sets the max heap size
The values of all three are passed directly to the JVM and support format/units as `<size>[g|G|m|M|k|K]`.
!!! example "Using docker run"
```
-e MEMORY=2G
```
or to use init and max memory:
```
-e INIT_MEMORY=1G -e MAX_MEMORY=4G
```
!!! example "Using compose file"
```
environment:
MEMORY: 2G
```
or to use init and max memory:
```
environment:
INIT_MEMORY: 1G
MAX_MEMORY: 4G
```
To let the JVM calculate the heap size from the container declared memory limit, unset `MEMORY` with an empty value, such as `-e MEMORY=""`. By default, the JVM will use 25% of the container memory limit as the heap limit; however, as an example the following would tell the JVM to use 75% of the container limit of 4GB of memory:
!!! example "MaxRAMPercentage using compose file"
```
environment:
MEMORY: ""
JVM_XX_OPTS: "-XX:MaxRAMPercentage=75"
deploy:
resources:
limits:
memory: 4G
```
!!! important
The settings above only set the Java **heap** limits. Memory resource requests and limits on the overall container should also account for non-heap memory usage. An extra 25% is [a general best practice](https://dzone.com/articles/best-practices-java-memory-arguments-for-container).
## Extra JVM Options
General JVM options can be passed to the Minecraft Server invocation by passing a `JVM_OPTS`
environment variable. The JVM requires `-XX` options to precede `-X` options, so those can be declared in `JVM_XX_OPTS`. Both variables are space-delimited, raw JVM arguments.
```
docker run ... -e JVM_OPTS="-someJVMOption someJVMOptionValue" ...
```
**NOTE** When declaring `JVM_OPTS` in a compose file's `environment` section with list syntax, **do not** include the quotes:
```yaml
environment:
- EULA=true
- JVM_OPTS=-someJVMOption someJVMOptionValue
```
Using object syntax is recommended and more intuitive:
```yaml
environment:
EULA: "true"
JVM_OPTS: "-someJVMOption someJVMOptionValue"
# or
# JVM_OPTS: -someJVMOption someJVMOptionValue
```
As a shorthand for passing several system properties as `-D` arguments, you can instead pass a comma separated list of `name=value` or `name:value` pairs with `JVM_DD_OPTS`. (The colon syntax is provided for management platforms like Plesk that don't allow `=` inside a value.)
For example, instead of passing
```yaml
JVM_OPTS: -Dfml.queryResult=confirm -Dname=value
```
you can use
```yaml
JVM_DD_OPTS: fml.queryResult=confirm,name=value
```
## Enable Remote JMX for Profiling
To enable remote JMX, such as for profiling with VisualVM or JMC, set the environment variable `ENABLE_JMX` to "true", set `JMX_HOST` to the IP/host running the Docker container, and add a port forwarding of TCP port 7091, such as:
If needing to map to a different port, then also set the environment variable `JMX_PORT` to the desired host port.
!!! example
With a compose file:
```yaml
environment:
ENABLE_JMX: true
JMX_HOST: ${HOSTNAME}
JMX_PORT: "7092"
ports:
- "7092:7092"
```
## Enable Aikar's Flags
[Aikar has done some research](https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/) into finding the optimal JVM flags for GC tuning, which becomes more important as more users are connected concurrently. [PaperMC also has an explanation](https://docs.papermc.io/paper/aikars-flags) of what the JVM flags are doing.
The set of flags documented there can be added using
-e USE_AIKAR_FLAGS=true
When `MEMORY` is greater than or equal to 12G, then the Aikar flags will be adjusted according to the article.
## Enable MeowIce's Flags
[MeowIce has created an updated set of JVM flags](https://github.com/MeowIce/meowice-flags?tab=readme-ov-file#why-would-i-have-to-switch-) based on Aikar's flags but with support for optimizations for Java 17 and above
The set of flags documented there can be added by setting the environment variable `USE_MEOWICE_FLAGS` to `true`. There is an optional `USE_MEOWICE_GRAALVM_FLAGS` variable to enable GraalVM specific optimizations, defaults to `FALSE`.
If you would like to run a custom server JAR, set `-e TYPE=CUSTOM` and pass the custom server
JAR via `CUSTOM_SERVER`. It can either be a URL or a container path to an existing JAR file.
If it is a URL, it will only be downloaded into the `/data` directory if it wasn't already. As
such, if you need to upgrade or re-download the JAR, then you will need to stop the container,
remove the file from the container's `/data` directory, and start again.
## Force re-download of the server file
For VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, CURSEFORGE, SPONGEVANILLA server types, set
`$FORCE_REDOWNLOAD` to some value (e.g. 'true) to force a re-download of the server file for
the particular server type. by adding a `-e FORCE_REDOWNLOAD=true` to your command-line.
For example, with PaperSpigot, it would look something like this:
```
docker run -d -v /path/on/host:/data \
-e TYPE=PAPER -e FORCE_REDOWNLOAD=true \
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
```
## Running as alternate user/group ID
By default, the container will switch to and run the Minecraft server as user ID 1000 and group ID 1000; however, that can be changed by setting the environment variables `UID` and `GID`.
The startup will also skip user switching if the `--user`/`-u` argument is passed to `docker run` or `user` is set on the compose service.
## Extra Arguments
Arguments that would usually be passed to the jar file (those which are written after the filename) can be passed via the `EXTRA_ARGS` environment variable.
See [Custom worlds directory path](../misc/world-data.md#custom-worlds-directory-path) for an example.
## Interactive and Color Console
When RCON is enabled, which is the default, and [TTY](https://docs.docker.com/compose/compose-file/05-services/#tty) is enabled on the container, then some server types will output colorized logs and provide a fully interactive console. To access the interactive console, use [`docker attach`](https://docs.docker.com/engine/reference/commandline/container_attach/) (not `exec`). When finished, make sure to use the sequence Control-P, Control-Q to detach without stopping the container.
If this behavior interferes with the log content, then disable TTY or remove the setting entirely since the default is disabled. In a compose file, set the service's `tty` parameter to `false`. On the `docker run` command-line remove the `-t` argument.
## Server Shutdown Options
To allow time for players to finish what they're doing during a graceful server shutdown, set `STOP_SERVER_ANNOUNCE_DELAY` to a number of seconds to delay after an announcement is posted by the server.
!!! warning "Increase stop grace period"
The Docker stop grace period must be increased to a value longer than the announce delay. The value to use that is longer than announce delay will vary based upon the amount of time it takes for final world data saving. If the container exits with exit code 137, then that indicates a longer grace period is needed.
The grace period can be increased using [the -t option on docker-compose down](https://docs.docker.com/compose/reference/down/) or set the [stop_grace_period](https://docs.docker.com/compose/compose-file/05-services/#stop_grace_period) in the compose file.
The `STOP_SERVER_ANNOUNCE_DELAY` can be bypassed by sending a `SIGUSR1` signal to the `mc-server-runner` process.
`docker`:
docker stop --signal SIGUSR1 mc
`docker compose`:
docker compose kill --signal SIGUSR1
## Configuration Options for Minecraft Server Health Monitoring
The image tags include specific variables to simplify configuration for monitoring the health of a Minecraft server:
-`-e SERVER_HOST=localhost` : This variable sets the host address of the Minecraft server to be monitored. By default, it is set to `localhost`, but you can replace it with the actual hostname or IP address of your Minecraft server.
-`-e SERVER_PORT=25565` : This variable sets the port number on which the Minecraft server is running. By default, Minecraft servers run on port 25565, but if your server is configured to use a different port, you should replace `25565` with the correct port number. This helps the monitoring system to accurately check the health status of the Minecraft server on the specified port.
## OpenJ9 Specific Options
The openj9 image tags include specific variables to simplify configuration:
-`-e TUNE_VIRTUALIZED=TRUE` : enables the option to
[optimize for virtualized environments](https://www.eclipse.org/openj9/docs/xtunevirtualized/)
-`-e TUNE_NURSERY_SIZES=TRUE` : configures nursery sizes where the initial size is 50%
of the `MAX_MEMORY` and the max size is 80%.
## Enabling rolling logs
By default the vanilla log file will grow without limit. The logger can be reconfigured to use a rolling log files strategy by using:
```
-e ENABLE_ROLLING_LOGS=true
```
> **NOTE** this will interfere with interactive/color consoles [as described in the section above](#interactive-and-color-console)
## Timezone Configuration
You can configure the timezone to match yours by setting the `TZ` environment variable:
-e TZ=Europe/London
such as:
docker run -d -it -e TZ=Europe/London -p 25565:25565 --name mc itzg/minecraft-server
Or mounting `/etc/timezone` as readonly (not supported on Windows):
-v /etc/timezone:/etc/timezone:ro
such as:
docker run -d -it -v /etc/timezone:/etc/timezone:ro -p 25565:25565 --name mc itzg/minecraft-server
## HTTP Proxy
You may configure the use of an HTTP/HTTPS proxy by passing the proxy's "host:port" via the environment variable `PROXY`. In [the example compose file](https://github.com/itzg/docker-minecraft-server/blob/master/examples/docker-compose-proxied.yml) it references a Squid proxy. The host and port can be separately passed via the environment variables `PROXY_HOST` and `PROXY_PORT`. A `|` delimited list of hosts to exclude from proxying can be passed via `PROXY_NON_PROXY_HOSTS`.
## Using "noconsole" option
Some older versions (pre-1.14) of Spigot required `--noconsole` to be passed when detaching stdin, which can be done by setting `-e CONSOLE=FALSE`.
## Explicitly disable GUI
Some older servers get confused and think that the GUI interface is enabled. You can explicitly
disable that by passing `-e GUI=FALSE`.
## Stop Duration
When the container is signaled to stop, the Minecraft process wrapper will attempt to send a "stop" command via RCON or console and waits for the process to gracefully finish. By default, it waits 60 seconds, but that duration can be configured by setting the environment variable `STOP_DURATION` to the number of seconds.
Be sure to also increase the shutdown timeout described [here for docker compose down](https://docs.docker.com/reference/cli/docker/compose/down/#options) and [here for docker stop](https://docs.docker.com/reference/cli/docker/container/stop/#options).
## Setup only
If you are using a host-attached data directory, then you can have the image setup the Minecraft server files and stop prior to launching the server process by setting `SETUP_ONLY` to `true`.
## Enable Flare Flags
To enable the JVM flags required to fully support the [Flare profiling suite](https://blog.airplane.gg/flare), set the following variable:
-e USE_FLARE_FLAGS=true
Flare is built-in to Pufferfish/Purpur, and is available in [plugin form](https://github.com/TECHNOVE/FlarePlugin) for other server types.
## Enable support for optimized SIMD operations
To enable support for optimized SIMD operations, the JVM flag can be set with the following variable:
-e USE_SIMD_FLAGS=true
SIMD optimized operations are supported by Pufferfish and Purpur.
## Downloading extra configuration files
You can download additional configuration files or other resources before the server starts by using the `DOWNLOAD_EXTRA_CONFIGS` environment variable. This is useful for downloading configs that you want to patch or modify during the startup process.
The format uses a `<` separator between the destination path and the source URL:
The files will be downloaded to `/data/` relative paths, so `plugins/WorldEdit` will be saved as `/data/plugins/WorldEdit/config.yml`.
!!! note
The downloaded files can be further processed using [environment variable replacement](interpolating.md) or [patch definitions](interpolating.md#patching-existing-files)
## Enable timestamps in init logs
Before the container starts the Minecraft Server its output is prefixed with `[init]`, such as
```
[init] Starting the Minecraft server...
```
To also include the timestamp with each log, set `LOG_TIMESTAMP` to "true". The log output will then look like:
```
[init] 2022-02-05 16:58:33+00:00 Starting the Minecraft server...
In order to unify management of the Minecraft server container, all of the [`server.properties`](https://minecraft.wiki/w/Server.properties) entries can be managed by the environment variables described in the sections below. Some of the mappings provide additional functionality above and beyond the properties file.
If you prefer to manually manage the `server.properties` file, set `OVERRIDE_SERVER_PROPERTIES` to "false". Similarly, you can entirely skip the startup script's creation of `server.properties` by setting `SKIP_SERVER_PROPERTIES` to "true".
!!! note
To clear a server property, set the variable to an empty string, such as `-e RESOURCE_PACK=""`. An unset variable is ignored and the existing server property is left unchanged.
To see what `server.properties` will get used by the server, set the environment variable `DUMP_SERVER_PROPERTIES` to "true" and the contents of `server.properties` will get output before the server starts.
## Placeholders
When declaring a server properties via container environment variables, those values may contain placeholders that are processed when the `server.properties` file is updated.
The syntax of placeholders is DOS-style, `%VAR%`, to avoid being processed by Docker or the shell and the following options are available:
`%VAR%` or `%env:VAR%`
: Replaced with the resolved value or the environment variable `VAR`
`%date:FMT%`
: Formats the current date/time with the given `FMT` string processed by [Java's DateTimeFormatter](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/format/DateTimeFormatter.html).
Any declared or resolved environment variable may be referenced, such as `VERSION` and `TYPE`. Additionally, [Modrinth](../types-and-platforms/mod-platforms/modrinth-modpacks.md) and [Auto CurseForge](../types-and-platforms/mod-platforms/auto-curseforge.md) modpacks will expose the environment variables `MODPACK_NAME` and `MODPACK_VERSION`. The originally declared version, such as "LATEST" or "SNAPSHOT", is available in the variable `DECLARED_VERSION`
!!! example
As a compose file environment entry:
```yaml
MOTD: Running %MODPACK_NAME% version %env:MODPACK_VERSION%
LEVEL: world-%date:yyyy-MM-dd%
```
!!! warning
Placeholders are not supported when manually managing `server.properties`
## Properties
### Message of the Day
The message of the day, shown below each server entry in the client UI, can be changed with the `MOTD` environment variable or a default is computed from the server type and version, such as
A Paper Minecraft Server powered by Docker
That way you can easily differentiate between several server types you may have started.
The section symbol (§) and other unicode characters are automatically converted to allow [formatting codes](https://minecraft.wiki/w/Formatting_codes) to be used consistently with all server versions. For Minecraft versions less than 1.20, unicode characters in `server.properties` will be escaped as `\uXXXX`, by default. That behavior can be altered by setting `SERVER_PROPERTIES_ESCAPE_UNICODE` to "true" or "false".
!!! example
With `docker run`
-e MOTD="A §l§cMinecraft§r §nserver"
or within a compose file
environment:
MOTD: "A §l§cMinecraft§r §nserver"
renders

To produce a multi-line MOTD, embed a newline character as `\n` in the string, such as the following example.
!!! example "Multi-line MOTD"
With `docker run`
```
-e MOTD="Line one\nLine two"
```
or within a compose file
```yaml
MOTD: |
line one
line two
# or
# MOTD: "line one\nline two"
```
The following example combines a multi-line MOTD with [placeholders](#placeholders) from the latest version of the installed modpack:
!!! example
```yaml
MOD_PLATFORM: AUTO_CURSEFORGE
CF_SLUG: craftoria
MOTD: |
A %TYPE% server on %VERSION%
running %MODPACK_NAME% %MODPACK_VERSION%
```

### Difficulty
The difficulty level (default: `easy`) can be set like:
```
docker run -d -e DIFFICULTY=hard ...
```
Valid values are: `peaceful`, `easy`, `normal`, and `hard`, and an
error message will be output in the logs if it's not one of these
values.
Refer to [the Minecraft wiki](https://minecraft.wiki/w/Difficulty)
### Whitelist Players
!!! warning "For public servers"
It is very important to consider setting a whitelist of expected players.
To whitelist players for your Minecraft server, you can:
- Provide a list of usernames and/or UUIDs separated by commas or newlines via the `WHITELIST` environment variable
- Provide the URL or container path to a whitelist file via `WHITELIST_FILE` that will be retrieved/copied into the standard location
!!! example
In a compose file, a text block can be used to improve maintainability, such as
```yaml
WHITELIST: |
user1
user2
user3
```
When either is set, [whitelisting of connecting users](https://minecraft.wiki/w/Server.properties#white-list) is enabled.
To change the behavior when the whitelist file already exists, set the variable `EXISTING_WHITELIST_FILE` to one of the following options:
`SKIP`
: Skip processing of the whitelist file when one is already present. This is the same as setting the legacy variable `OVERRIDE_WHITELIST` to "false".
`SYNCHRONIZE`
: Synchronize the list of users in the file with the `WHITELIST` or `WHITELIST_FILE` provided. When using both, `WHITELIST` will take precedence. This is the same as setting the legacy variable `OVERRIDE_WHITELIST` to "true".
`MERGE`
: Merge the list of users from `WHITELIST` into the existing file. `WHITELIST_FILE` cannot be used with this option.
`SYNC_FILE_MERGE_LIST` (default)
: When `WHITELIST_FILE` is provided it will overwrite an existing whitelist file. Also, if `WHITELIST` is provided, then those users will be merged into the newly copied file.
!!! note
For versions prior to 1.7.3, `white-list.txt` will be maintained instead. Only usernames are supported for those versions.
To [enforce the whitelist changes immediately](https://minecraft.wiki/w/Server.properties#enforce-whitelist) when whitelist commands are used , set `ENFORCE_WHITELIST` to "true". If managing the whitelist file manually, `ENABLE_WHITELIST` can be set to "true" to set the `white-list` property.
!!! tip "Changing user API provider"
The usernames provided for whitelist and ops processing are resolved using either [PlayerDB](https://playerdb.co/) or [Mojang's API](https://wiki.vg/Mojang_API#Username_to_UUID). The default uses PlayerDB, but can be changed by setting the environment variable `USER_API_PROVIDER` to "mojang". Sometimes one or the other service can become overloaded, which is why there is the ability to switch providers.
### Op/Administrator Players
Similar to the whitelist, users can be provisioned as operators (aka administrators) to your Minecraft server by
- Providing a list of usernames and/or UUIDs separated by commas or newlines via the `OPS` environment variable
- Providing the URL or container path to an ops file via `OPS_FILE` that will be retrieved/copied into the standard location
!!! example
In a compose file, a text block can be used to improve maintainability, such as
```yaml
OPS: |
user1
user2
user3
```
To change the behavior when the ops file already exists, set the variable `EXISTING_OPS_FILE` to one of the following options:
`SKIP`
: Skip processing of the ops file when one is already present. This is the same as setting the legacy variable `OVERRIDE_OPS` to "false".
`SYNCHRONIZE`
: Synchronize the list of users in the file with the `OPS` or `OPS_FILE` provided. When using both, `OPS` will take precedence. The `level` and `bypassesPlayerLimit` will be retained from previous entries. This is the same as setting the legacy variable `OVERRIDE_OPS` to "true".
`MERGE`
: Merge the list of users from `OPS` into the existing file. `OPS_FILE` cannot be used with this option.
`SYNC_FILE_MERGE_LIST` (default)
: When `OPS_FILE` is provided it will overwrite an existing ops file. Also, if `OPS` is provided, then those users will be merged into the newly copied file.
!!! note
For versions prior to 1.7.3, `ops.txt` will be maintained instead. Only usernames are supported for those versions.
### Enable/disable initial selection of datapacks
New to [22W42A](https://www.minecraft.net/en-us/article/minecraft-snapshot-22w42a), datapacks with feature flags can be controlled before initial world creation by setting these to a comma separated list of packs:
- `INITIAL_ENABLED_PACKS`
such as "update_1_20,bundle"
- `INITIAL_DISABLED_PACKS`
### Server icon
A server icon can be configured by setting the `ICON` variable to a URL to download or a container path. The image will be automatically downloaded (if a URL), scaled, and converted from any other image format:
!!! example
Using `docker run`:
```
docker run -d -e ICON=http://..../some/image.png ...
```
In compose file:
```yaml
environment:
ICON: http://..../some/image.png
```
Using a file from host filesystem:
```yaml
environment:
ICON: /icon.png
OVERRIDE_ICON: true
volumes:
./icon.png:/icon.png
```
By default an existing `server-icon.png` file will not be replaced, that can be changed by setting `OVERRIDE_ICON` to "true".
### RCON
RCON is **enabled by default** to allow for graceful shut down the server and coordination of save state during backups. RCON can be disabled by setting `ENABLE_RCON` to "false".
!!! warning
Disabling RCON will remove and limit some features, such as interactive and color console support.
The default password is randomly generated on each startup; however, a specific one can be set with `RCON_PASSWORD`.
**DO NOT MAP THE RCON PORT EXTERNALLY** unless you are aware of all the consequences and have set a **secure password** with `RCON_PASSWORD`.
!!! info
Mapping ports (`-p` command line or `ports` in compose) outside the container and docker networking needs to be a purposeful choice. Most production Docker deployments do not need any of the Minecraft ports mapped externally from the server itself.
By default, the server listens for RCON on port 25575 within the container. It can be changed with `RCON_PORT` but only do this if you have a very good reason. **DO NOT change `rcon.port` via `server.properties`** or integrations will break.
### Query
Set the environment variable `ENABLE_QUERY` to "true" to enable the gamespy query protocol. Maps to the server property [enable-query](https://minecraft.wiki/w/Server.properties#enable-query). By default, the query port will be `25565` (UDP) but can be changed with the `QUERY_PORT` environment variable.
### Level Seed
If you want to create the Minecraft level with a specific seed, set the environment variable `SEED`, which maps to the [level-seed](https://minecraft.wiki/w/Server.properties#level-seed) property.
If using a negative value for the seed, make sure to quote the value such as:
!!! example "Using docker run"
```
-e SEED="-1785852800490497919"
```
!!! example "Using compose"
```yaml
environment:
SEED: "-1785852800490497919"
```
### Game Mode
By default, Minecraft servers are configured to run in Survival mode. You can
change the mode using `MODE` where you can either provide the [standard
numerical values](http://minecraft.wiki/Game_mode#Game_modes) or the
shortcut values:
- creative
- survival
- adventure
- spectator (only for Minecraft 1.8 or later)
For example:
docker run -d -e MODE=creative ...
### Level Type and Generator Settings
By default, a standard world is generated with hills, valleys, water, etc. A different level type can
be configured by setting `LEVEL_TYPE` to [an expected type listed here](https://minecraft.wiki/w/Server.properties#level-type).
For some of the level types, `GENERATOR_SETTINGS` can be used to further customize the world generation.
To configure the `GENERATOR_SETTINGS` you need to add the appropriate `GeneratorOptions` JSON configuration. In the case of a superflat world, you may omit the `flat_world_options`.
The layers are applied from -64 and up and are added in the order of the list
Example for a superflat world:
- 1x bedrock
- 2x stone
- 15x sandstone
- Desert biome
```yaml
environment:
LEVEL_TYPE: FLAT
GENERATOR_SETTINGS: >-
{
"layers": [
{
"block": "minecraft:bedrock",
"height": 1
},
{
"block": "minecraft:stone",
"height": 2
},
{
"block": "minecraft:sandstone",
"height": 15
}
],
"biome": "minecraft:desert"
}
```
For more details, refer to the Minecraft Wiki sections for [Superflat Multiplayer](https://minecraft.wiki/w/Superflat#Multiplayer) and [generator options tag format](https://minecraft.wiki/w/Java_Edition_level_format#generatorOptions_tag_format).
### Custom Server Resource Pack
You can set a link to a custom resource pack and set it's checksum using the `RESOURCE_PACK` and `RESOURCE_PACK_SHA1` options respectively, the default is blank:
docker run -d -e 'RESOURCE_PACK=http://link.com/to/pack.zip?=1' -e 'RESOURCE_PACK_SHA1=d5db29cd03a2ed055086cef9c31c252b4587d6d0'
You can enforce the resource pack on clients by setting `RESOURCE_PACK_ENFORCE` to `TRUE` (default: `FALSE`).
### Level / World Save Name
You can either switch between world saves or run multiple containers with different saves by using the `LEVEL` option,
where the default is "world":
docker run -d -e LEVEL=bonus ...
> **NOTE:** if running multiple containers be sure to either specify a different `-v` host directory for each
`LEVEL` in use or don't use `-v` and the container's filesystem will keep things encapsulated.
> **INFO** Refer to the [data directory](../data-directory.md) section for a visual description of where the `$LEVEL` directory is situated.
### Server port
> **WARNING:** only change this value if you know what you're doing. It only needs to be changed when using host-networking and it is rare that host networking should be used. Use `-p` port mappings instead.
If you must, the server port can be set like:
!!! example "Using docker run"
```
docker run -d -e SERVER_PORT=25566 ...
```
!!! example "Using compose"
```yaml
environment:
SERVER_PORT: 25566
```
**however**, be sure to change your port mapping accordingly and be prepared for some features to break.
### Custom server properties
Some mods/plugins utilize custom `server.properties` entries which can be declared via the `CUSTOM_SERVER_PROPERTIES` environment variable. The contents must be newline delimited `name=value` pairs.
Within a compose file, newline delimited entries can be declared as shown here:
Everything the container manages is located under the **container's**`/data` path, as shown here:

!!! note
The container path `/data` is pre-declared as a volume, so if you do nothing then it will be allocated as an anonymous volume. As such, it is subject to removal when the container is removed.
### Attaching data directory to host filesystem
In most cases the easiest way to persist and work with the minecraft data files is to use [bind mounts](https://docs.docker.com/storage/bind-mounts/) with the `-v` argument to map a directory on your host machine to the container's `/data` directory. In the following example, the path `/home/user/minecraft-data`**must be** a directory on your host machine:
-v /home/user/minecraft-data:/data
------------------------- -----
| |
| +-- must always be /data
|
+-- replace with a directory on your host machine
When attached in this way you can stop the server, edit the configuration under your attached directory and start the server again to pick up the new configuration.
!!! important "Rootless, Podman, SELinux, AppArmor usage"
When running rootless containers, such as with Podman, or using SELinux / AppArmor on your system, append ":Z" to the volume mapping. For example:
```
/home/user/minecraft-data:/data:Z
```
There might be a safer/better way to accommodate these systems. Please post an issue or PR if you have more information.
With Docker Compose, setting up a host attached directory is even easier since relative paths can be configured. For example, with the following `docker-compose.yml` Docker will automatically create/attach the relative directory `minecraft-data` to the container.
``` yaml title="docker-compose.yml"
services:
mc:
image: itzg/minecraft-server
ports:
- 25565:25565
environment:
EULA: "TRUE"
tty: true
stdin_open: true
restart: unless-stopped
volumes:
# attach a directory relative to the directory containing this compose file
- ./minecraft-data:/data
```
### Converting anonymous `/data` volume to named volume
If you had used the commands in the first section, without the `-v` volume attachment, then an anonymous data volume was created by Docker. You can later bring over that content to a named or host attached volume using the following procedure.
!!! note
In this example, it is assumed the original container was given a `--name` of "mc", so change the container identifier accordingly.
You can also locate the Docker-managed directory from the `Source` field obtained from `docker inspect <container id or name> -f "{{json .Mounts}}"`
First, stop the existing container:
``` shell
docker stop mc
```
Use a temporary container to copy over the anonymous volume's content into a named volume, "mc" in this case:
``` shell
docker run --rm --volumes-from mc -v mc:/new alpine cp -avT /data /new
```
Now you can recreate the container with any environment variable changes, etc by attaching the named volume created from the previous step:
[](https://github.com/itzg/docker-minecraft-server/actions)
This docker image provides a Minecraft Server that will automatically download the latest stable
version at startup. You can also run/upgrade to any specific version or the
latest snapshot. See the _Versions_ section below for more information.
To simply use the latest stable version, run
docker run -d -it -p 25565:25565 -e EULA=TRUE itzg/minecraft-server
where, in this case, the standard server port 25565, will be exposed on your host machine.
!!! note
If you plan on running a server for a longer amount of time it is highly recommended using a management layer such as [Docker Compose](#using-docker-compose) or [Kubernetes](misc/deployment/index.md#on-kubernetes) to allow for incremental reconfiguration and image upgrades.
!!! info
Be sure to always include `-e EULA=TRUE` in your commands and container definitions, as Mojang/Microsoft requires EULA acceptance.
!!! warning
**DO NOT** port forward RCON on 25575 without first setting `RCON_PASSWORD` to a secure value. It is highly recommended to only use RCON within the container, such as with `rcon-cli`.
By default, the container will download the latest version of the "vanilla" [Minecraft: Java Edition server](https://www.minecraft.net/en-us/download/server) provided by Mojang. The [`VERSION`](versions/minecraft.md) and the [`TYPE`](types-and-platforms/index.md) can be configured to create many variations of desired Minecraft server.
## Using [Docker Compose](https://docs.docker.com/compose/)
1. Create a new directory
2. Put the contents of the file below in a file called `docker-compose.yml`
3. Run `docker compose up -d` in that directory
4. Done! Point your client at your host's name/IP address and port 25565.
```yaml
services:
mc:
image:itzg/minecraft-server
tty:true
stdin_open:true
ports:
- "25565:25565"
environment:
EULA:"TRUE"
volumes:
# attach the relative directory 'data' to the container's /data path
- ./data:/data
```
To apply changes made to the compose file, just run `docker compose up -d` again.
Follow the logs of the container using `docker compose logs -f`, check on the status with `docker compose ps`, and stop the container using `docker compose stop`.
!!! note "Configurator Tool"
If you prefer to use an interactive tool to create or edit a Docker Compose file for this image, you can check out [setupmc.com's configurator](https://setupmc.com/java-server/). It provides a form that supports most of the image variables and generates the `compose.yml` file in real time.
!!! note "More Compose Examples"
There are more [examples located in the Github repo](https://github.com/itzg/docker-minecraft-server/tree/master/examples).
!!! note "Deployment Examples"
The [deployments page](misc/deployment/index.md) provides more examples of deployment with and beyond Docker Compose.
As of [1.21.2](https://minecraft.wiki/w/Java_Edition_1.21.2) it is not recommend to use this feature since Minecraft server natively auto-pauses when the server is empty. That is configured via the enivironment variable `PAUSE_WHEN_EMPTY_SECONDS`, which maps to the `pause-when-empty-seconds` server property.
An auto-pause functionality is provided that monitors whether clients are connected to the server. If a client is not connected for a specified time, the Java process is put into a pause state. When a client attempts to connect while the process is paused, then process will be restored to a running state. The experience for the client does not change. This feature can be enabled by setting the environment variable `ENABLE_AUTOPAUSE` to "true".
!!! important
**You must greatly increase or disable max-tick-time watchdog functionality.** From the server's point of view, the pausing causes a single tick to take as long as the process is stopped, so the server watchdog might intervene after the process is continued, possibly forcing a container restart. To prevent this, ensure that the `max-tick-time` in the `server.properties` file is set to a very large value or -1 to disable it entirely, which is highly recommended. That can be set with `MAX_TICK_TIME` as described in [the section below](../../configuration/server-properties.md#max-tick-time).
Non-vanilla versions might have their own configuration file, you might have to disable their watchdogs separately. For PaperMC servers, you need to send the JVM flag `-Ddisable.watchdog=true`, this can be done with the docker env variable `-e JVM_DD_OPTS=disable.watchdog:true`
On startup the `server.properties` file is checked and, if applicable, a warning is printed to the terminal. When the server is created (no data available in the persistent directory), the properties file is created with the Watchdog disabled.
The utility used to wake the server (`knock(d)`) works at network interface level. So the correct interface has to be set using the `AUTOPAUSE_KNOCK_INTERFACE` variable when using non-default networking environments (e.g. host-networking, Portainer oder NAS solutions). See the description of the variable below.
A file called `.paused` is created in `/data` directory when the server is paused and removed when the server is resumed. Other services may check for this file's existence before waking the server.
A `.skip-pause` file can be created in the `/data` directory to make the server skip autopausing, for as long as the file is present. The autopause timer will also be reset.
A starting, example compose file has been provided in [the examples](https://github.com/itzg/docker-minecraft-server/blob/master/examples/autopause/compose.yml).
Auto-pause is not compatible with `EXEC_DIRECTLY=true` and the two cannot be set together.
!!! note
When configuring kubernetes readiness/liveness health checks with auto-pause enabled, be sure to reference the `mc-health` wrapper script rather than `mc-status` directly.
## Additional configuration
The following environment variables define the behaviour of auto-pausing:
describes the time between server start and the pausing of the process, when no client connects inbetween (read as timeout initialized)
-`AUTOPAUSE_TIMEOUT_KN`, default `120` (seconds)
describes the time between knocking of the port (e.g. by the main menu ping) and the pausing of the process, when no client connects inbetween (read as timeout knocked)
-`AUTOPAUSE_PERIOD`, default `10` (seconds)
describes period of the daemonized state machine, that handles the pausing of the process (resuming is done independently)
-`AUTOPAUSE_KNOCK_INTERFACE`, default `eth0`
<br>Describes the interface passed to the `knockd` daemon. If the default interface does not work, run the `ifconfig` command inside the container and derive the interface receiving the incoming connection from its output. The passed interface must exist inside the container. Using the loopback interface (`lo`) does likely not yield the desired results.
-`AUTOPAUSE_STATUS_RETRY_LIMIT`, default 10
-`AUTOPAUSE_STATUS_RETRY_INTERVAL`, default 2s
!!! tip
To troubleshoot, add `DEBUG_AUTOPAUSE=true` to see additional output
## Rootless Auto-Pause
If you're running the container as rootless, then it is necessary to add the `CAP_NET_RAW` capability to the container, such as using [the `cap_add` service field](https://docs.docker.com/compose/compose-file/05-services/#cap_add) in a compose file or [`--cap-add` docker run argument](https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities). It may also be necessary to set the environment variable `SKIP_SUDO` to "true".
You might need to set change the default port forwarder from RootlessKit to slirp4netns.
An option to stop the server after a specified time has been added for niche applications (e.g. billing saving on AWS Fargate). The function is incompatible with the Autopause functionality, as they basically cancel out each other.
!!! note
the docker container variables have to be set accordingly (restart policy set to "no") and that the container has to be manually restarted.
A `.skip-stop` file can be created in the `/data` directory to make the server skip autostopping, for as long as the file is present. The autostop timer will also be reset.
A starting, example compose file has been provided in [examples/docker-compose-autostop.yml](https://github.com/itzg/docker-minecraft-server/blob/master/examples/docker-compose-autostop.yml).
Enable the Autostop functionality by setting:
```
-e ENABLE_AUTOSTOP=TRUE
```
The following environment variables define the behavior of auto-stopping:
-`AUTOSTOP_TIMEOUT_EST`, default `3600` (seconds)
describes the time between the last client disconnect and the stopping of the server (read as timeout established)
describes the time between server start and the stopping of the server, when no client connects in-between (read as timeout initialized)
-`AUTOSTOP_PERIOD`, default `10` (seconds)
describes period of the daemonized state machine, that handles the stopping of the server
-`AUTOPAUSE_STATUS_RETRY_LIMIT`, default 10
-`AUTOPAUSE_STATUS_RETRY_INTERVAL`, default 2s
> To troubleshoot, add `DEBUG_AUTOSTOP=true` to see additional output
## Proxy Support
If you make use of PROXY Protocol, i.e. through something like HAProxy or Fly.io, you will need to enable it in your variety of server's configuration, and then set the `USES_PROXY_PROTOCOL` envar to `true`. This lets Autostop monitor the server, where it otherwise wouldn't
This page describes a capability that is not applicable to most users. It is only intended for rare cases when a very specific Java base image is needed or additional packages need to be installed that are not generally applicable or would bloat the image size.
Be sure to confirm that the desired [version and variant of Java isn't already provided](../versions/java.md).
## Building image locally with alternate Java base
An alternate Java base image can be specified by setting the [docker build argument](https://docs.docker.com/reference/cli/docker/buildx/build/#build-arg) `BASE_IMAGE` to the desired base image. The following shows an example of using the base image `ghcr.io/graalvm/graalvm-ce:ol8-java11`:
Adding a new server `TYPE` can vary due to the complexity of obtaining and configuring each type; however, the addition of any server type includes at least the following steps:
1. Copy an existing "start-deploy*" script, such as [start-deployFabric](https://github.com/itzg/docker-minecraft-server/blob/master/scripts/start-deployFabric) and rename it accordingly making sure to retain the "start-deploy" prefix
2. Modify the type-specific behavior between the "start-utils" preamble and the hand-off to `start-setupWorld` at the end of the script
3. Develop and test the changes using the [iterative process described below](#iterative-script-development)
4. Add a case-entry to the `case "${TYPE^^}"` in [start-configuration](https://github.com/itzg/docker-minecraft-server/blob/master/scripts/start-configuration)
5. Add a section to the [docs](https://github.com/itzg/docker-minecraft-server/tree/master/docs). It is recommended to copy-modify an existing section to retain a similar wording and level of detail
6. [Submit a pull request](https://github.com/itzg/docker-minecraft-server/pulls)
## Iterative script development
Individual scripts can be iteratively developed, debugged, and tested using the following procedure.
First, build a baseline of the image to include the packages needed by existing or new scripts:
PowerShell: (Example of building and testing ForgeAPI)
```powershell
$env:FOLDER_TO_TEST="forgeapimods_projectids"
$env:IMAGE_TO_TEST="mc-dev"
dockerbuild-t$env:IMAGE_TO_TEST.
pushd "tests/setuponlytests/$env:FOLDER_TO_TEST/"
docker-composerunmc
docker-composedown-v--remove-orphans
popd
```
PowerShell: Building different images of Java for testing
Using the baseline image, an interactive container can be started to iteratively run the scripts to be developed. By attaching the current workspace directory, you can use the local editor of your choice to iteratively modify scripts while using the container to run them.
```shell
docker run -it --rm -v ${PWD}:/image/scripts --entrypoint bash mc-dev
```
From within the container you can run individual scripts via the attached `/image/scripts/` path; however, be sure to set any environment variables expected by the scripts by either `export`ing them manually:
```shell
exportVERSION=1.12.2
/image/scripts/start-deployFabric
```
...or pre-pending script execution:
```shell
VERSION=1.12.2 /image/scripts/start-deployFabric
```
!!! note
You may want to temporarily add an `exit` statement near the end of your script to isolate execution to just the script you're developing.
## Using development copy of tools
In the cloned repo, such as [`mc-image-helper`](https://github.com/itzg/mc-image-helper), install the distribution locally by running:
```shell
./gradlew installDist
```
The distribution will be installed in the project's `build/install/mc-image-helper`. Obtain the absolute path to that directory use in the next step.
Refer to the instructions above to mount any locally modified image scripts or build a local copy of the image using or with alternate `BASE_IMAGE`, as described above:
```shell
docker build -t itzg/minecraft-server .
```
Mount the local mc-image-helper distribution directory as a volume in the container at the path `/usr/share/mc-image-helper`, such as
The documentation for this image/repository is written in markdown and built by [MkDocs](https://www.mkdocs.org/) into a documentation website hosted at [Read the Docs](https://readthedocs.org/). [Here is general information about writing MkDocs markdown](https://www.mkdocs.org/user-guide/writing-your-docs/) and [specifics for the Material theme used](https://squidfunk.github.io/mkdocs-material/reference/).
!!! note
The README.md rarely needs to be modified and only serves as a brief introduction to the project.
The documentation source is maintained in the [docs](https://github.com/itzg/docker-minecraft-server/tree/master/docs) folder and is organized into sections by directory and files. Look through the existing content to determine if an existing file should be updated or a new file/directory added.
It will be very helpful to view the rendered documentation as you're editing. To do that run the following from the top-level directory:
```shell
docker compose -f docker-compose-mkdocs.yml -p mkdocs up
```
You can access the live documentation rendering at <http://localhost:8000>.
[Shulker](https://github.com/jeremylvln/Shulker) is a Kubernetes operator for managing complex and dynamic Minecraft infrastructures, including game servers and proxies. It uses the docker-minecraft-server and docker-bungeecord images under-the-hood.
## With Ansible
[Ansible](https://docs.ansible.com/ansible/latest/getting_started/introduction.html) is an open-source task automation tool built in [Python](https://www.python.org/). Ansible playbooks can be used to automate all kinds of tasks, including deploying remote Minecraft servers.
### Using the MASH playbook
[The MASH Playbook](https://github.com/mother-of-all-self-hosting/mash-playbook) is a premade playbook with the option to deploy a [wide variety of open-source services](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/supported-services.md) to your server(s), including [docker-minecraft-server](https://github.com/XHawk87/ansible-role-minecraft), making it a good option if you want all the bells and whistles alongside your Minecraft server.
- Check out the [Installation Guide](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/README.md) for the MASH playbook to get started.
- You can then enable [Minecraft](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/minecraft.md) in your vars.yml.
- Enable any supporting services that you might find useful, such as [user authentication](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/authelia.md), [remote backups](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/backup-borg.md), [email relay](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/exim-relay.md), [cron monitoring](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/healthchecks.md), [audio and video conferencing](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/jitsi.md), databases ([MariaDB](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/mariadb.md), [PostgresSQL](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/postgres.md)), [push notifications](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/ntfy.md), [uptime monitoring](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/uptime-kuma.md), [a website](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/wordpress.md), as well as installing any [extra files, folders, applications, services and running commands](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/auxiliary.md) automatically on deployment.
## On CloudFormation (AWS)
If you're looking for a simple way to deploy this to the Amazon Web Services Cloud, check out the [Minecraft Server Deployment (CloudFormation) repository](https://github.com/vatertime/minecraft-spot-pricing). This repository contains a CloudFormation template that will get you up and running in AWS in a matter of minutes. Optionally it uses Spot Pricing so the server is very cheap, and you can easily turn it off when not in use.
## Supporting Articles
Below are supporting articles for server deployment.
- "Zero to Minecraft Server with Docker Desktop and Compose"
- This is a reference guide/tutorial on how to set up a vanilla Minecraft server using this project, including step-by-step instructions, and information on topics such as port-forwarding.
Various examples are [maintained in the repository](https://github.com/itzg/docker-minecraft-server/tree/master/examples). The sections below highlight a few particular ones.
## Bedrock compatible server
Using the [GeyserMC plugin](https://geysermc.org/) with a Paper server (or similar) "enables clients from Minecraft Bedrock Edition to join your Minecraft Java server". The example also includes [Floodgate](https://wiki.geysermc.org/floodgate/) which "allows Xbox Live authenticated Bedrock users to join without a Java Edition account".
## Lazymc - Put your Minecraft server to rest when idle
With [lazymc-docker-proxy](https://github.com/joesturge/lazymc-docker-proxy) you are able to use [lazymc](https://github.com/timvisee/lazymc) with the minecraft container.
```yaml
# Lazymc requires that the minecraft server have a static IP.
#
# To ensure that our servers have a static IP we need to create
# a network for our services to use.
#
# By default, Docker uses 172.17.0.0/16 subnet range.
# So we need to create a new network in a different subnet
# See the readme for more information.
#
# Please ensure that the subnet falls within the private CIDRs:
## Lazytainer - Stop Minecraft container based on traffic
Monitors network traffic to the Minecraft containers. If there is traffic, the container runs, otherwise the container is stopped/paused.
By using [Lazytainer](https://github.com/vmorganp/Lazytainer) with the [docker-minecraft-server](https://github.com/itzg/docker-minecraft-server) a somehow similar behaviour to [Lazymc](https://github.com/timvisee/lazymc) can be archived.
```yaml
services:
lazytainer:
image:ghcr.io/vmorganp/lazytainer:master
environment:
VERBOSE:false
ports:
- 25565:25565
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
labels:
- lazytainer.group.minecraft.sleepMethod=stop
- lazytainer.group.minecraft.ports=25565
- lazytainer.group.minecraft.minPacketThreshold=2# Start after two incomming packets
- lazytainer.group.minecraft.inactiveTimeout=600# 10 minutes, to allow the server to bootstrap. You can probably make this lower later if you want.
This image contains [mc-monitor](https://github.com/itzg/mc-monitor) and uses its `status` command to continually check on the container's. That can be observed from the `STATUS` column of `docker ps`
```
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b418af073764 mc "/start" 43 seconds ago Up 41 seconds (healthy) 0.0.0.0:25565->25565/tcp, 25575/tcp mc
```
You can also query the container's health in a script-friendly way:
``` shell
> docker container inspect -f "{{.State.Health.Status}}" mc
healthy
```
There's actually a wrapper script called `mc-health` that takes care of calling `mc-monitor status` with the correct arguments. If needing to customize the health checks parameters, such as in a Compose file, then use something like the following in the service declaration:
``` yaml
healthcheck:
test: mc-health
start_period: 1m
interval: 5s
retries: 20
```
Some orchestration systems, such as Portainer, don't allow for disabling the default `HEALTHCHECK` declared by this image. In those cases you can approximate the disabling of health checks by setting the environment variable `DISABLE_HEALTHCHECK` to `true`.
The [health check in a Compose service declaration](https://docs.docker.com/reference/compose-file/services/#healthcheck) can also be disabled using:
```yaml
healthcheck:
disable: true
test: ["NONE"]
```
### Health checks for older versions
This container disables health checks for Minecraft versions before b1.8 as those versions do not support any kind of server pinging. For more information see [Server List Ping](https://minecraft.wiki/w/Java_Edition_protocol/Server_List_Ping#Beta_1.8_to_1.3).
**Please ensure you have pulled the latest image** since [all official mitigations](https://www.minecraft.net/en-us/article/important-message--security-vulnerability-java-edition) are automatically applied by the container startup process.
To run this image on a RaspberryPi 3 B+, 4, or newer, use any of the image tags [list in the Java version section](../versions/java.md) that specify `armv7` for the architecture, which includes `itzg/minecraft-server:latest`.
!!! note
You may need to lower the memory allocation, such as `-e MEMORY=750m`
!!! note
If experiencing issues such as "sleep: cannot read realtime clock: Operation not permitted", ensure `libseccomp` is up to date on your host. In some cases adding `:Z` flag to the `/data` mount may be needed, [but use cautiously](https://docs.docker.com/storage/bind-mounts/#configure-the-selinux-label).
To troubleshoot the container initialization, such as when server files are pre-downloaded, set the environment variable `DEBUG` to `true`. The container logs will include **much more** output, and it is highly recommended including that output when reporting any [issues](https://github.com/itzg/docker-minecraft-server/issues).
To troubleshoot just the command-line used to start the Minecraft server, set the environment variable `DEBUG_EXEC` to `true`.
To troubleshoot any issues with memory allocation reported by the JVM, set the environment variable `DEBUG_MEMORY` to `true`.
If you are experiencing any issues with the "Changing ownership of /data" step, that can be disabled by setting `SKIP_CHOWN_DATA` to `true`.
To confirm the image version that has been pulled, use the following command, replacing `itzg/minecraft-server` as needed for specific image tags:
"org.opencontainers.image.description":"Docker image that provides a Minecraft Server for Java Edition that automatically downloads selected version at startup",
Instead of mounting the `/data` volume, you can instead specify the URL of a ZIP or compressed TAR file containing an archived world. It will be searched for a file `level.dat` and the containing subdirectory moved to the directory named by `$LEVEL`. This means that most of the archived Minecraft worlds downloadable from the Internet will already be in the correct format.
docker run -d -e WORLD=http://www.example.com/worlds/MySave.zip ...
!!! note
This URL must be accessible from inside the container. Therefore, you should use an IP address or a globally resolvable FQDN, or else the name of a linked container.
!!! note
If the archive contains more than one `level.dat`, then the one to select can be picked with `WORLD_INDEX`, which defaults to 1.
## Cloning world from a container path
The `WORLD` option can also be used to reference a directory, zip file, or compressed tar file that will be used as a source to clone or extract the world directory.
For example, the following would initially clone the world's content from `/worlds/basic`. Also notice in the example that you should use a read-only volume attachment to ensure the clone source remains pristine.
```
docker run ... -v $HOME/worlds:/worlds:ro -e WORLD=/worlds/basic
```
The following diagram shows how this option can be used in a compose deployment with a relative directory:

## Overwrite world on start
The world will only be downloaded or copied if it doesn't exist already. Set `FORCE_WORLD_COPY=TRUE` to force overwrite the world on every server start.
## Custom worlds directory path
To set a custom worlds directory for the Multiverse plugin on a baremetal server, you'd pass the `--world-dir` argument after the jar file.
In order to accomplish the same in a containerized server, set the `EXTRA_ARGS` environment variable in your command line or docker compose yaml to the same argument string. For example:
```
docker run -d -e EXTRA_ARGS='--world-dir ./worlds/'
```
`--world-container`, `-W`, and `--universe` are aliases to `--world-dir` and can also be used.
## Datapacks
Datapacks can be installed in a similar manner to mods/plugins. There are many environment variables which function in the same way they do for [mods](../mods-and-plugins/index.md):
*`DATAPACKS`: comma-separated list of zip file URL, zip file in container, or directory in container
*`DATAPACKS_FILE`: a text file within the container where each line is a zip file URL, zip file in container, or directory in container
*`REMOVE_OLD_DATAPACKS`: if "true" the datapacks directory is removed of everything matching `REMOVE_OLD_DATAPACKS_INCLUDE`, but excluding `REMOVE_OLD_DATAPACKS_EXCLUDE` no deeper than `REMOVE_OLD_DATAPACKS_DEPTH`
*`REMOVE_OLD_DATAPACKS_DEPTH`: default is 16
*`REMOVE_OLD_DATAPACKS_INCLUDE`: default is `*.zip`
*`REMOVE_OLD_DATAPACKS_EXCLUDE`: default is empty
Datapacks will be placed in `/data/$LEVEL/datapacks`
## VanillaTweaks
[VanillaTweaks](https://vanillatweaks.net/) datapacks, crafting tweaks, and resource packs can be installed with a share code from the website **OR** a json file to specify packs to download and install. Datapacks and crafting tweaks will be installed into the current world directory specified by `$LEVEL`. As new versions of the packs are retrieved the previous versions will automatically be cleaned up.
The share code is the part following the hash sign, as shown here:
```
https://vanillatweaks.net/share/#MGr52E
------
|
+- share code MGr52E
```
Accepted Parameters:
-`VANILLATWEAKS_FILE`: comma separated list of JSON VanillaTweak pack files accessible within the container
-`VANILLATWEAKS_SHARECODE`: comma separated list of share codes
Example of expected VanillaTweaks share codes:
!!! note
ResourcePacks, DataPacks, and CraftingTweaks all have separate sharecodes
``` yaml
VANILLATWEAKS_SHARECODE: MGr52E,tF1zL2,LnEDwT
```
!!! note
Datapack names are all lower case. [See their spec](https://vanillatweaks.net/assets/resources/json/1.21/dpcategories.json) for a full list of 1.21 datapacks, and [their spec](https://vanillatweaks.net/assets/resources/json/1.21/ctcategories.json) for a full list of 1.21 crafting tweaks.
Mods and plugins can be auto-downloaded and upgraded from CurseForge by setting `CURSEFORGE_FILES` to a comma or space delimited list of [project-file references](#project-file-references). References removed from the declaration are automatically cleaned up and setting `CURSEFORGE_FILES` to an empty string removes all previously managed project-files.
A specific file can be omitted from each reference to allow for auto-selecting the newest version of the selected mod/plugin. The resolved `VERSION` and `TYPE` will be taken into consideration for selecting the appropriate file.
!!! warning "CurseForge API key usage"
A CurseForge API key must be allocated and set with `CF_API_KEY` (or `CF_API_KEY_FILE`) [as described here](../types-and-platforms/mod-platforms/auto-curseforge.md#api-key).
## Project-file references
!!! tip
Individual project files typically represent a version of the mod/plugin, but CurseForge refers to these items broadly as "files" rather than "versions".
The following formats are supported in the list of project-file references:
- A project page URL, such as `https://www.curseforge.com/minecraft/mc-mods/jei`. _The newest applicable file will be automatically selected._
- A file page URL, such as `https://www.curseforge.com/minecraft/mc-mods/jei/files/4593548`
- Project slug, such as `jei`. _The newest applicable file will be automatically selected._
- Project ID, such as `238222`. _The newest applicable file will be automatically selected._
- Project slug or ID, `:`, and a file ID, such as `jei:4593548` or `238222:4593548`
- Project slug or ID, `@`, and a partial filename, such as `jei@10.2.1.1005`. This option is useful to refer to a version of the mod/plugin rather than looking up the file ID.
- An `@` followed by the **container path** to a listing file
!!! info "More about listing files"
Each line in the listing file is processed as one of the references above; however, blank lines and comments that start with `#` are ignored.
Make sure to place the listing file in a mounted directory/volume or declare an appropriate mount for it.
For example, `CURSEFORGE_FILES` can be set to "@/extras/cf-mods.txt", assuming "/extras" has been added to `volumes` section, where the container file `/extras/cf-mods.txt` contains
```text
# This comment is ignored
jei:10.2.1.1005
# This and previous blank line are ignore
geckolib
aquaculture
naturalist
```
!!! tip "Multi-line values in Docker Compose"
Making use of the space delimited option, compose file declarations can be organized nicely with a [multi-line string](https://yaml-multiline.info/), such as
```yaml
CURSEFORGE_FILES: |
geckolib
aquaculture
naturalist
```
## Dependencies
The files processing can detect if a dependency is missing from the given list, but is not able to resolve the dependencies otherwise since their metadata only gives the mod ID and not the specific file version/ID that is needed.
By far the easiest way to work with mod and plugins, especially large numbers of them, is to utilize modpacks with [one of the supported modpack platforms](../types-and-platforms/index.md).
The following are some supported modpack platforms:
- [Feed the Beast](../types-and-platforms/mod-platforms/ftb.md)
## Download automation
On the left, there are sections describing some download automation options.
## Mods vs Plugins
The terms "mods" and "plugins" can be quite confusing. Generally, the rule of thumb is that "mods" are used by the types that run client side to modify rendering, add new blocks, and add behaviors server, such as [Forge](../types-and-platforms/server-types/forge.md) and [Fabric](../types-and-platforms/server-types/fabric.md). "Plugins" are used by the types that **only run on servers** to add behaviors, commands, etc such as [Paper](../types-and-platforms/server-types/paper.md) (which derives from [Bukkit/Spigot](../types-and-platforms/server-types/bukkit-spigot.md)). There are also some types that are [hybrids](../types-and-platforms/server-types/hybrids.md), such as Magma, that use both "mods" and "plugins".
Typically, mods needs to be installed in both the client and server; however, there are some cases when only the server needs a mod. Plugins only need to be installed in the server and are never needed in the client.
## Optional plugins, mods, and config attach points
There are optional volume paths that can be attached to supply content to be copied into the data area:
`/plugins`
: content in this directory is synchronized into `/data/plugins` for server types that use plugins, [as described above](#mods-vs-plugins). For special cases, the source can be changed by setting `COPY_PLUGINS_SRC` and destination by setting `COPY_PLUGINS_DEST`. If using a mod-based loader, such as Forge or Fabric, but a hybrid mod like [Cardboard](https://modrinth.com/mod/cardboard), then set `USES_PLUGINS` to have the automation utilize `/plugins` mount.
`/mods`
: content in this directory is synchronized into `/data/mods` for server types that use mods, [as described above](#mods-vs-plugins). For special cases, the source can be changed by setting `COPY_MODS_SRC` and destination by setting `COPY_MODS_DEST`.
`/config`
: contents are synchronized into `/data/config` by default, but can be changed with `COPY_CONFIG_DEST`. For example, `-v ./config:/config -e COPY_CONFIG_DEST=/data` will allow you to copy over files like `bukkit.yml` and so on directly into the server directory. The source can be changed by setting `COPY_CONFIG_SRC`. Set `SYNC_SKIP_NEWER_IN_DESTINATION=false` if you want files from `/config` to take precedence over newer files in `/data/config`.
By default, the [environment variable processing](../configuration/interpolating.md) is performed on synchronized files that match the expected suffixes in `REPLACE_ENV_SUFFIXES` (by default "yml,yaml,txt,cfg,conf,properties,hjson,json,tml,toml") and are not excluded by `REPLACE_ENV_VARIABLES_EXCLUDES` and `REPLACE_ENV_VARIABLES_EXCLUDE_PATHS`. This processing can be disabled by setting `REPLACE_ENV_DURING_SYNC` to `false`.
If you want old mods/plugins to be removed before the content is brought over from those attach points, then add `-e REMOVE_OLD_MODS=TRUE`. You can fine tune the removal process by specifying the `REMOVE_OLD_MODS_INCLUDE` and `REMOVE_OLD_MODS_EXCLUDE` variables, which are comma separated lists of file glob patterns. If a directory is excluded, then it and all of its contents are excluded. By default, only jars are removed.
You can also specify the `REMOVE_OLD_MODS_DEPTH` (default is 16) variable to only delete files up to a certain level.
For example: `-e REMOVE_OLD_MODS=TRUE -e REMOVE_OLD_MODS_INCLUDE="*.jar" -e REMOVE_OLD_MODS_DEPTH=1` will remove all old jar files that are directly inside the `plugins/` or `mods/` directory.
These paths work well if you want to have a common set of modules in a separate location, but still have multiple worlds with different server requirements in either persistent volumes or a downloadable archive.
!!! information "Multiple source directories"
`COPY_PLUGINS_SRC`, `COPY_MODS_SRC`, `COPY_CONFIG_SRC` can each be set to a comma or newline delimited list of container directories to reference.
For example, in a compose file:
```yaml
environment:
# ...EULA, etc
TYPE: PAPER
# matches up to volumes declared below
COPY_PLUGINS_SRC: /plugins-common,/plugins-local
volumes:
- mc-data:/data
# For example, reference a shared directory used by several projects
- ../plugins-common:/plugins-common:ro
# and add plugins unique to this project
- ./plugins:/plugins-local:ro
```
Alternatively, you can declare other directories along with files and URLs to use in [the `MODS` / `PLUGINS` variables](#modsplugins-list).
## Zip file modpack
Like the `WORLD` option above, you can specify the URL or container path of a "mod pack" to download and install into `mods` for Forge/Fabric or `plugins` for Bukkit/Spigot. To use this option pass the environment variable `MODPACK`, such as
```shell
docker run -d -e MODPACK=http://www.example.com/mods/modpack.zip ...
```
!!! note
The referenced URL/file must be a zip file with one or more jar files at the
top level of the zip archive. Make sure the jars are compatible with the
particular `TYPE` of server you are running.
## Generic pack files
To install all the server content (jars, mods, plugins, configs, etc.) from a zip or tgz file, then set `GENERIC_PACK` to the container path or URL of the archive file. This can also be used to apply a CurseForge modpack that is missing a server start script and/or Forge installer.
If multiple generic packs need to be applied together, set `GENERIC_PACKS` instead, with a comma separated list of archive file paths and/or URLs to files.
To avoid repetition, each entry will be prefixed by the value of `GENERIC_PACKS_PREFIX` and suffixed by the value of `GENERIC_PACKS_SUFFIX`, both of which are optional. For example, the following variables
```
GENERIC_PACKS=configs-v9.0.1,mods-v4.3.6
GENERIC_PACKS_PREFIX=https://cdn.example.org/
GENERIC_PACKS_SUFFIX=.zip
```
would expand to `https://cdn.example.org/configs-v9.0.1.zip,https://cdn.example.org/mods-v4.3.6.zip`.
If applying large generic packs, the update can be time-consuming. To skip the update set `SKIP_GENERIC_PACK_UPDATE_CHECK` to "true". Conversely, the generic pack(s) can be forced to be applied by setting `FORCE_GENERIC_PACK_UPDATE` to "true".
The most time-consuming portion of the generic pack update is generating and comparing the SHA1 checksum. To skip the checksum generation, set `SKIP_GENERIC_PACK_CHECKSUM` to "true".
To disable specific mods, which can be useful for conflicts between multiple generic packs, you can use the `GENERIC_PACKS_DISABLE_MODS` variable to specify mods to disable.
Disabling mods with docker run:
```shell
docker run -d -e GENERIC_PACKS_DISABLE_MODS="mod1.jar mod2.jar" ...
```
Disabling mods within docker compose files:
```yaml
GENERIC_PACKS_DISABLE_MODS: |
mod1.jar
mod2.jar
```
## Mods/plugins list
You may also download or copy over individual mods/plugins using the `MODS` or `PLUGINS` environment variables. Both are a comma or newline delimited list of
- URL of a jar file
- container path to a jar file
- container path to a directory containing jar files
```shell
docker run -d -e MODS=https://www.example.com/mods/mod1.jar,/plugins/common,/plugins/special/mod2.jar ...
```
The newline delimiting allows for compose file usage like:
As an alternative to `MODS`/`PLUGINS`, the variable `MODS_FILE` or `PLUGINS_FILE` can be set with the container path or URL of a text file listing a mod/plugin URLs on each line. For example, the following
-e MODS_FILE=/extras/mods.txt
would load from a file mounted into the container at `/extras/mods.txt`. That file might look like:
Blank lines and lines that start with a `#` will be ignored
[This compose file](https://github.com/itzg/docker-minecraft-server/blob/master/examples/mods-file/docker-compose.yml) shows another example of using this feature.
## Remove old mods/plugins
When the `MODPACK` option above is specified you can also instruct script to delete old mods/plugins prior to installing new ones. This behaviour is desirable in case you want to upgrade mods/plugins from downloaded zip file.
To use this option pass the environment variable `REMOVE_OLD_MODS=TRUE`, such as
```shell
docker run -d -e REMOVE_OLD_MODS=TRUE -e MODPACK=http://www.example.com/mods/modpack.zip ...
```
!!! danger
All content of the `mods` or `plugins` directory will be deleted before unpacking new content from the MODPACK or MODS.
[Modrinth](https://modrinth.com/) is an open source modding platform with a clean, easy to use website for finding [Fabric, Forge, etc mods](https://modrinth.com/mods) and [Paper, etc plugins](https://modrinth.com/plugins), and [datapacks](https://modrinth.com/datapacks). At startup, the container will automatically locate and download the newest versions of mod/plugin files that correspond to the `TYPE` and `VERSION` in use. Older file versions downloaded previously will automatically be cleaned up.
- **MODRINTH_PROJECTS** : comma or newline separated list of project slugs (short name) or IDs. The project ID is located in the "Technical information" section. The project slug is the part of the URL that follows `/mod/`, `/plugin/`, or `/datapack/`. For example:
```
https://modrinth.com/mod/fabric-api
----------
|
+-- project slug
```
Also, a specific version (or release type) can be declared adding a colon and then the version id, version number/name, or release type after the project slug. The version ID or number can be found in the 'Metadata' section. Valid release types are `release`, `beta`, `alpha`.
To select a datapack from a Modrinth project, prefix the entry with "datapack:". When running a vanilla server, this is optional since only datapacks will be available for vanilla servers to select.
You can also reference a file containing project entries by prefixing the **container path** path with `@`.
Each line in the listing file is processed as one of the references above; however, blank lines and comments that start with `#` are ignored.
Make sure to place the listing file in a mounted directory/volume or declare an appropriate mount for it.
For example, `MODRINTH_PROJECTS` can be set to "@/extras/modrinth-mods.txt", assuming "/extras" has been added to `volumes` section, where the container file `/extras/modrinth-mods.txt` contains
```text
# This comment is ignored
fabric-api
# This and previous blank line are ignore
cloth-config
datapack:terralith
```
## Version from Projects
When the environment variable `VERSION_FROM_MODRINTH_PROJECTS` is set to "true" the Minecraft [`VERSION`](../versions/minecraft.md) will be automatically determined by looking at the most recent version of Minecraft that is supported by all the projects provided in `MODRINTH_PROJECTS`.
!!! example
Given the environment variables
```yaml
MODRINTH_PROJECTS: |
viaversion
viabackwards
griefprevention
discordsrv
VERSION_FROM_MODRINTH_PROJECTS: true
```
Let's say all are supported on Minecraft up to 1.21.8 except griefprevention, which is only supported up to 1.21.7. In that case, `VERSION` will be automatically set to 1.21.7.
## Extra options
`MODRINTH_DOWNLOAD_DEPENDENCIES`
: Can be set to `none` (the default), `required`, or `optional` to download required and/or optional dependencies.
`MODRINTH_ALLOWED_VERSION_TYPE`
: The version type is used to determine the newest version to use from each project. The allowed values are `release` (default), `beta`, `alpha`. Setting to `beta` will pick up both release and beta versions. Setting to `alpha` will pick up release, beta, and alpha versions.
`MODRINTH_LOADER`
: When using a custom server, set this to specify which loader type will be requested during lookups
[packwiz](https://packwiz.infra.link/) is a CLI tool for maintaining and providing modpack definitions, with support for both CurseForge and Modrinth as sources. See the [packwiz tutorial](https://packwiz.infra.link/tutorials/getting-started/) for more information.
To configure server mods using a packwiz modpack, set the `PACKWIZ_URL` environment variable to the location of your `pack.toml` modpack definition:
```
docker run -d -v /path/on/host:/data -e TYPE=FABRIC \
packwiz modpack definitions are processed before other mod definitions (`MODPACK`, `MODS`, etc.) to allow for additional processing/overrides you may want to perform (in case of mods not available via Modrinth/CurseForge, or you do not maintain the pack).
!!! note
packwiz is pre-configured to only download server mods. If client-side mods are downloaded and cause issues, check your pack.toml configuration, and make sure any client-only mods are not set to `"both"`, but rather `"client"` for the side configuration item.
The `SPIGET_RESOURCES` variable can be set with a comma-separated list of SpigotMC resource IDs to automatically download [Spigot/Bukkit/Paper plugins](https://www.spigotmc.org/resources/) using [the spiget API](https://spiget.org/). Resources that are zip files will be expanded into the plugins directory and resources that are simply jar files will be moved there.
!!! important "SPIGET not SPIGOT"
The variable is purposely spelled SPIG**E**T with an "E"
The **resource ID** can be located from the numerical part of the URL after the shortname/slug and a dot. For example, the ID is **28140** from
For example, the following will auto-download the [LuckPerms](https://www.spigotmc.org/resources/luckperms.28140/) and [Vault](https://www.spigotmc.org/resources/vault.34315/) plugins:
-e SPIGET_RESOURCES=28140,34315
!!! note
Some plugins, such as EssentialsX (resource ID 9089), do not permit automated downloads via Spiget. Instead, you will need to pre-download the desired file and supply it to the container, such as using the `/plugins` mount point, described [in the main section](index.md).
Server types can be selected by setting the `TYPE` environment variable to one of the types described in these sections.
The default server type is [the official software provided by Mojang](https://www.minecraft.net/en-us/download/server), which can be explicitly selected by setting `TYPE` to "VANILLA".
**From the sections to the left...**
The **modpack platforms** take a modpack identifier, file, etc and use that to select and download the appropriate version of a mod loader, such as Forge or Fabric, downloading declared mods/plugins, and apply any additional files. The modpack platforms are selected by setting `MODPACK_PLATFORM`; however, for ease of use and backward compatibility, the selection can be set in `TYPE` or `MOD_PLATFORM`.
The individual **server types** allow for selecting the mod loader / server type and specific versions of those.
!!! important
For all the server types, the `VERSION` environment variable is used to declare the Minecraft version itself, such as 1.19.4. Each server type will have specific variables for qualifying their version in addition to the Minecraft version.
To manage a CurseForge modpack automatically with upgrade support, pinned or latest version tracking, set `MODPACK_PLATFORM`, `MOD_PLATFORM` or `TYPE` to "AUTO_CURSEFORGE". The appropriate mod loader (Forge / Fabric) version will be automatically installed as declared by the modpack. This mode will also take care of cleaning up unused files installed by previous versions of the modpack, but world data is never auto-removed.
## API Key
!!! warning "CurseForge API key usage"
A CurseForge API key is **required** to use this feature. Go to their [developer console](https://console.curseforge.com/), generate an API key, and set the environment variable `CF_API_KEY`.
When entering your API Key in a docker compose file you will need to escape any `$` character with a second `$`. Refer to [this compose file reference section](https://docs.docker.com/compose/compose-file/compose-file-v3/#variable-substitution) for more information.
Example if your key is `$11$22$33aaaaaaaaaaaaaaaaaaaaaaaaaa`:
If you use `docker run` you will need to make sure to use single quotes:
```shell
docker run ... -e CF_API_KEY='$11$22$33aaaaaaaaaaaaaaaaaaaaaaaaaa'
```
To avoid exposing the API key, it is highly recommended to use a `.env` file, which is [loaded automatically by docker compose](https://docs.docker.com/compose/environment-variables/set-environment-variables/#substitute-with-an-env-file). You **do not** need to escape `$`'s with a second `$` in the `.env` file **as long as the key is wrapped in single quotes**.
```
# .env
CF_API_KEY='$11$22$33aaaaaaaaaaaaaaaaaaaaaaaaaa'
```
The variable should to be referenced from the compose file, such as:
```yaml
# compose.yaml
environment:
CF_API_KEY: ${CF_API_KEY}
```
The .env file should be placed in the same directory as your compose file like so:
```
/minecraft-server
├── .env
├── compose.yaml
├── /data
```
To use the equivalent with `docker run` you need to specify the `.env` file explicitly:
```
docker run --env-file=.env itzg/minecraft-server
```
Alternately you can use [docker secrets](https://docs.docker.com/compose/how-tos/use-secrets/) with a `CF_API_KEY_FILE` environment variable:
```
service:
environment:
CF_API_KEY_FILE: /run/secrets/cf_api_key
secrets:
- cf_api_key
secrets:
cf_api_key:
file: cf_api_key.secret
```
!!! note
Be sure to use the appropriate [image tag for the Java version compatible with the modpack](../../versions/java.md).
Most modpacks require a good amount of memory, so it best to set `MEMORY` to at least "4G" since the default is only 1 GB.
## Usage
Use one of the following to specify the modpack to install:
Pass a page URL to the modpack or a specific file with `CF_PAGE_URL` such as the modpack page "https://www.curseforge.com/minecraft/modpacks/all-the-mods-8" or a specific file "https://www.curseforge.com/minecraft/modpacks/all-the-mods-8/files/4248390". For example:
Instead of a URL, the modpack slug can be provided as `CF_SLUG`. The slug is the short identifier visible in the URL after "/modpacks/", such as

For example:
```
-e TYPE=AUTO_CURSEFORGE -e CF_SLUG=all-the-mods-8
```
### Pinning modpack and mod loader versions
The latest modpack file and its associated mod loader will be located and installed by default on startup (including automatic upgrading of both on subsequent startups, if a later version is found on CurseForge). If a specific version is desired instead, you can use one of the following options. With any of these options **do not select a server file** -- they lack the required manifest and defeat the ability to consistently automate startup.
- Use `CF_PAGE_URL`, but include the full URL to a specific file
- Set `CF_FILE_ID` to the numerical file ID
- Specify a substring to match the desired filename with `CF_FILENAME_MATCHER`
The following shows where to get the URL to the specific file and also shows where the file ID is located:

The following examples all refer to version 1.0.7 of ATM8:
Pinning modpack version also pins the mod loader (to the version specified by the modpack). Mod loader version cannot be pinned independently of the modpack.
## Manual Downloads
For mod, modpacks, and world files that are not allowed for automated download, the container path `/downloads` can be attached and matching files will be retrieved from there. The subdirectories `mods`, `modpacks`, and `worlds` will also be checked accordingly. To change the source location of downloaded files, set `CF_DOWNLOADS_REPO` to an existing container path. To disable this feature, set `CF_DOWNLOADS_REPO` to an empty string.
!!! warning "Download using a browser"
It's important to use a browser to download the files listed for manual download. If your Docker host is running without a graphical interface, then you can use `scp` or similar to transfer the files to it.
!!! example
Assuming Docker compose is being used:
1. Create a directory next to the `docker-compose.yml` file. The name doesn't matter, but "downloads" is the common convention
2. From the "Mods Need Download" output, visit the download page of each, click on the file download and save that file into the directory created in the previous step
3. Add a host directory mount to the volumes section where the container path **must be** `/downloads`. The snippet below shows how that will look
4. Re-run `docker compose up -d` to apply the changes
```yaml
volumes:
./downloads:/downloads
```
## Unpublished Modpacks
If you wish to use an unpublished modpack zip, set the container path to the file in `CF_MODPACK_ZIP`. Similarly, the container path to a modpack manifest JSON can be passed to `CF_MODPACK_MANIFEST`. In either case, **the modpack slug or page URL must still be provided**.
!!! example
```yaml
services:
mc:
image: itzg/minecraft-server
environment:
EULA: true
MODPACK_PLATFORM: AUTO_CURSEFORGE
# allocate from https://console.curseforge.com/ and set in .env file
CF_API_KEY: ${CF_API_KEY}
CF_MODPACK_MANIFEST: /manifests/manifest.json
CF_SLUG: "custom"
volumes:
- ./manifests:/manifests:ro
```
where an exported manifest file should look like:
```json
{
"minecraft": {
"version": "1.20.4",
"modLoaders": [
{
"id": "fabric-0.15.3",
"primary": true
}
]
},
"manifestType": "minecraftModpack",
"manifestVersion": 1,
"name": "Custom",
"author": "",
"files": [
{
"projectID": 351725,
"fileID": 4973035,
"required": true
},
{
"projectID": 306612,
"fileID": 5010374,
"required": true
}
],
"overrides": "overrides"
}
```
## Exclude client mods
Quite often there are mods that need to be excluded, such as ones that did not properly declare as a client mod via the file's game versions. Similarly, there are some mods that are incorrectly tagged as client only. The following describes two options to exclude/include mods:
Mods can be excluded by passing a comma or space delimited list of **project** slugs or IDs via `CF_EXCLUDE_MODS`. Similarly, there are some mods that are incorrectly tagged as client only. For those, pass the **project** slugs or IDs via `CF_FORCE_INCLUDE_MODS`. These lists will be combined with the content of the exclude/include file, if given.
!!! note
`CF_FORCE_INCLUDE_MODS` will not download additional mods.
For additional mods, refer to [the `CURSEFORGE_FILES` variable](../../mods-and-plugins/curseforge-files.md).
A mod's project ID can be obtained from the right hand side of the project page:

For more complex scenarios, global and per modpack exclusions can be declared in a container-accessible JSON file and referenced with `CF_EXCLUDE_INCLUDE_FILE`. By default, [the file bundled with the image](https://raw.githubusercontent.com/itzg/docker-minecraft-server/master/files/cf-exclude-include.json) will be used, but can be disabled by setting this to an empty string. The schema of this file [is documented here](https://github.com/itzg/mc-image-helper#excludeinclude-file-schema).
If needing to iterate on the options above, set `CF_FORCE_SYNCHRONIZE` to "true" to ensure the exclude/includes are re-evaluated.
!!! important
These options are provided to empower you to get your server up and running quickly. Please help out by reporting an issue with the respective mod project. Ideally mod developers should [use correct registrations for one-sided client mods](https://docs.minecraftforge.net/en/latest/concepts/sides/#writing-one-sided-mods). Understandably, those code changes may be non-trivial, so mod authors can also add "Client" to the game versions when publishing.
## Excluding Overrides Files
Modpack zip files typically include an `overrides` subdirectory that may contain config files, world data, and extra mod files. All of those files will be extracted into the `/data` path of the container. If any of those files, such as incompatible mods, need to be excluded from extraction, then the `CF_OVERRIDES_EXCLUSIONS` variable can be set with a comma or newline delimited list of ant-style paths ([see below](#ant-style-paths)) to exclude, relative to the overrides (or `/data`) directory.
### Ant-style paths
Ant-style paths can include the following globbing/wildcard symbols:
or using newline delimiter, which improves maintainability
```yaml
CF_OVERRIDES_EXCLUSIONS: |
mods/iris*.jar
mods/sodium*.jar
```
## World/Level Data
Some modpacks come with world/save data via a worlds file and/or the overrides provided with the modpack. Either approach can be selected to set the `LEVEL` to the resulting saves directory by setting `CF_SET_LEVEL_FROM` to either:
- `WORLD_FILE`
- `OVERRIDES`
## Ignore missing files
Some mods use temporary files from the modpack and delete them when finished. Others will patch themselves and "disable" the original mod jar, such as gregtech. In order to avoid the installer from detecting the absent file(s) and re-installing, those files can be ignored by passing a comma or newline delimited list to `CF_IGNORE_MISSING_FILES`.
!!! hint
A warning log will indicate what files were found to be missing from the previous installation run, such as
```
Re-installing due to missing files from modpack: [mods/gregtech-2.6.2-beta.jar]
```
!!! example
In a Compose file
```yaml
environment:
CF_IGNORE_MISSING_FILES: |
mods/gregtech-2.6.2-beta.jar
```
## Extra options
Other configuration available:
- `CF_PARALLEL_DOWNLOADS` (default is 4): specify how many parallel mod downloads to perform
- `CF_OVERRIDES_SKIP_EXISTING` (default is false): if set, files in the overrides that already exist in the data directory are skipped. **NOTE** world data is always skipped, if present.
- `CF_FORCE_REINSTALL_MODLOADER` (default is false): this can be set to `true` to force the modpack's declared modloader, such as Forge, to be reinstalled. This is useful if some of the modloader's files become corrupted.
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
### Modpack data directory
By default, CurseForge modpacks are expanded into the sub-directory `/data/FeedTheBeast` and executed from there. (The default location was chosen for legacy reasons, when Curse and FTB were maintained together.)
The directory can be changed by setting `CF_BASE_DIR`, such as `-e CF_BASE_DIR=/data`.
### Buggy start scripts
Some modpacks have buggy or overly complex start scripts. You can avoid using the bundled start script and use this image's standard server-starting logic by adding `-e USE_MODPACK_START_SCRIPT=false`.
### Fixing "unable to launch forgemodloader"
If your server's modpack fails to load with an error [like this](https://support.feed-the-beast.com/t/cant-start-crashlanding-server-unable-to-launch-forgemodloader/6028/2):
unable to launch forgemodloader
then you apply a workaround by adding this to the run invocation:
Requires one of the Ubuntu with Hotspot images listed in [the Java versions section](../../versions/java.md).
[Feed the Beast application](https://www.feed-the-beast.com/) modpacks are supported by setting `MODPACK_PLATFORM`, `MOD_PLATFORM` or `TYPE` to "FTBA"
!!! note
The "A" at the end of "FTBA" is important. The value "FTB" used to be an alias for "CURSEFORGE".
This mod platform type will automatically take care of downloading and installing the modpack and appropriate version of Forge, so the `VERSION` does not need to be specified.
### Environment Variables:
-`FTB_MODPACK_ID`: **required**, the numerical ID of the modpack to install. The ID can be located by [finding the modpack](https://www.feed-the-beast.com/modpack) and locating the ID in this part of the URL:
- `FTB_MODPACK_VERSION_ID`: optional, the numerical ID of the version to install. If not specified, the latest version will be installed. The "Version ID" can be obtained by hovering over a server file entry and grabbing [this ID in the URL](../../img/ftba-version-id-popup.png).
- `FTB_FORCE_REINSTALL`: if the files become inconsistent, such as when accidentally removing them, the FTB can be forced to re-run by setting this to "true"
### Upgrading
If a specific `FTB_MODPACK_VERSION_ID` was not specified, simply restart the container to pick up the newest modpack version. If using a specific version ID, recreate the container with the new version ID.
### Example
The following example runs the latest version of [FTB Presents Direwolf20 1.12](https://ftb.neptunepowered.org/pack/ftb-presents-direwolf20-1-12/):
``` shell
docker run -d --name mc-ftb -e EULA=TRUE \
-e TYPE=FTBA -e FTB_MODPACK_ID=31 \
-p 25565:25565 \
itzg/minecraft-server:java8-multiarch
```
!!! note
Normally you will also add `-v` volume for `/data` since the mods and config are installed there along with world data.
[Modrinth Modpacks](https://modrinth.com/modpacks) can automatically be installed along with the required mod loader (Forge or Fabric) by setting `MODPACK_PLATFORM`, `MOD_PLATFORM` or `TYPE` to "MODRINTH". Upgrading (and downgrading) takes care of cleaning up old files and upgrading (and downgrading) the mod loader.
## Modpack project
The desired modpack project is specified with the `MODRINTH_MODPACK` environment variable and must be one of:
- The project "slug", which is located in the URL shown here:

- The project ID, which is located in the bottom of the left panel, shown here

- The project page URL, such as <https://modrinth.com/modpack/cobblemon-fabric>. As described below, this can further be the page URL of a modpack's version page.
- A custom URL of a hosted [mrpack file](https://support.modrinth.com/en/articles/8802351-modrinth-modpack-format-mrpack)
- The container path to a local [mrpack file](https://support.modrinth.com/en/articles/8802351-modrinth-modpack-format-mrpack)
## Modpack version
The automatic modpack version resolving can be narrowed in a few ways:
The latest release or beta version, respectively, of the Modrinth modpack is selected when `VERSION` is "LATEST" or "SNAPSHOT". That can be overridden by setting `MODRINTH_DEFAULT_VERSION_TYPE` to "release", "beta", or "alpha".
The resolved modpack version can be narrowed by setting `VERSION` to a specific Minecraft version, such as "1.19.2".
The selected version can also be narrowed to a particular mod loader by setting `MODRINTH_LOADER` to either "forge", "fabric", or "quilt".
Instead of auto resolving, a specific version of modpack file can be specified by passing the version's page URL to `MODRINTH_MODPACK`, such as <https://modrinth.com/modpack/cobblemon-fabric/version/1.3.2> or by setting `MODRINTH_VERSION` to the version ID or number located in the Metadata section, as shown here

## Ignore missing files
Some mods, such as [MCInstance Loader](https://modrinth.com/mod/mcinstance-loader), use temporary files from the modpack and delete them when finished. In order to avoid the installer from detecting the absent file(s) and re-installing, those files can be ignored by passing a comma or newline delimited list to `MODRINTH_IGNORE_MISSING_FILES`.
!!! example
In a Compose file
```yaml
environment:
MODRINTH_IGNORE_MISSING_FILES: |
config/mcinstanceloader/pack.mcinstance
```
## Excluding files
To exclude client mods that are incorrectly declared by the modpack as server-compatible, set `MODRINTH_EXCLUDE_FILES` to a comma or newline delimited list of partial file names to exclude. You may need to set `MODRINTH_FORCE_SYNCHRONIZE` to "true" while iterating on a compatible set of mods to use.
!!! example
In a Compose file:
```yaml
MODRINTH_EXCLUDE_FILES: |
notenoughanimations
lambdynamiclights
euphoriapatcher
```
## Force-include files
To force include client mods, set `MODRINTH_FORCE_INCLUDE_FILES` to a comma or newline delimited list of partial file names. You may need to set `MODRINTH_FORCE_SYNCHRONIZE` to "true" while iterating on a compatible set of mods to use.
!!! example
In a Compose file:
```yaml
MODRINTH_FORCE_INCLUDE_FILES: |
yet-another-config-lib
```
## Default exclude/includes
The image comes with a default set of exclude/includes, maintained [in the repo files area](https://github.com/itzg/docker-minecraft-server/blob/master/files/modrinth-exclude-include.json) and uses the same [JSON schema](https://github.com/itzg/mc-image-helper?tab=readme-ov-file#excludeinclude-file-schema) as Auto CurseForge. Those defaults can be disabled by setting the env var `MODRINTH_DEFAULT_EXCLUDE_INCLUDES` to an empty string.
## Excluding Overrides Files
Modrinth mrpack/zip files may include an `overrides` subdirectory that contains config files, world data, and extra mod files. All of those files will be extracted into the `/data` path of the container. If any of those files, such as incompatible mods, need to be excluded from extraction, then the `MODRINTH_OVERRIDES_EXCLUSIONS` variable can be set with a comma or newline delimited list of ant-style paths ([see below](#ant-style-paths)) to exclude, relative to the overrides (or `/data`) directory.
### Ant-style paths
Ant-style paths can include the following globbing/wildcard symbols:
!!! failure "GetBukkit site no longer supports automated downloads"
The downloads provider <https://getbukkit.org> seems to no longer support automated downloads. As such, it is highly recommended to switch to [Paper](paper.md) instead since it is actively maintained and fully compatible with Bukkit/Spigot plugins.
Run a Bukkit/Spigot server type by setting the environment variable `TYPE` to "BUKKIT" or "SPIGOT".
!!! example
Command-line
```
docker run ... -e TYPE=SPIGOT ...
```
Compose
```yaml
environment:
...
TYPE: SPIGOT
```
If the downloaded server jar is corrupted, set `FORCE_REDOWNLOAD` to "true" to force a re-download during next container startup. After successfully re-downloading, you should remove that or set to "false".
If you are hosting your own copy of Bukkit/Spigot you can override the download URLs with:
- -e BUKKIT_DOWNLOAD_URL=<url>
- -e SPIGOT_DOWNLOAD_URL=<url>
!!! note
Some of the `VERSION` values are not as intuitive as you would think, so make sure to click into the version entry to find the **exact** version needed for the download. For example, "1.8" is not sufficient since their download naming expects `1.8-R0.1-SNAPSHOT-latest` exactly.
## Build from source
You can build spigot from source by setting the environment variable `BUILD_FROM_SOURCE` to "true".
## Alternatives
### Canyon
[Canyon](https://github.com/canyonmodded/canyon) is a fork of CraftBukkit for Minecraft Beta 1.7.3. It includes multiple enhancements whilst also retaining compatibility with old Bukkit plugins and mods as much as possible.
-e VERSION=b1.7.3 -e TYPE=CANYON
!!! important
Only `VERSION=b1.7.3` is supported. Since that version pre-dates the health check mechanism used by this image, that will need to be disabled by setting `DISABLE_HEALTHCHECK=true`.
Canyon is on a temporary hiatus, so by default the final build from GitHub will be used; however, a specific build number can be selected in some instances by setting `CANYON_BUILD`, such as
-e CANYON_BUILD=6
-e CANYON_BUILD=26
### Poseidon
[Poseidon](https://github.com/retromcorg/Project-Poseidon) is a fork of CraftBukkit for Minecraft Beta 1.7.3. It includes multiple enhancements whilst also retaining compatibility with old Bukkit plugins.
-e VERSION=b1.7.3 -e TYPE=CANYON
!!! important
Only `VERSION=b1.7.3` is supported. Since that version pre-dates the health check mechanism used by this image, that will need to be disabled by setting `DISABLE_HEALTHCHECK=true`.
### Uberbukkit
[Uberbukkit](https://github.com/Moresteck/uberbukkit) is a fork of CraftBukkit for Minecraft Beta with Multi version support, supports b1.0 - b1.7.3
A [Fabric server](https://fabricmc.net/) can be automatically downloaded, upgraded, and run by setting the environment variable TYPE to "FABRIC"
!!! example
Using `docker run` command line
```
docker run -d -e EULA=TRUE -e TYPE=FABRIC -p 25565:25565 itzg/minecraft-server
```
In a compose file service:
```yaml
environment:
EULA: TRUE
TYPE: FABRIC
```
By default, the container will install the latest [fabric server launcher](https://fabricmc.net/use/server/), using the latest [fabric-loader](https://fabricmc.net/wiki/documentation:fabric_loader) against the minecraft version you have defined with `VERSION` (defaulting to the latest vanilla release of the game).
A specific loader or launcher version other than the latest can be requested using `FABRIC_LOADER_VERSION` and `FABRIC_LAUNCHER_VERSION` respectively, such as:
!!! example "Using launcher and loader versions"
With docker run
```
docker run -d ... \
-e TYPE=FABRIC \
-e FABRIC_LAUNCHER_VERSION=0.10.2 \
-e FABRIC_LOADER_VERSION=0.13.1
```
In a compose file service:
```yaml
environment:
EULA: TRUE
TYPE: FABRIC
FABRIC_LAUNCHER_VERSION: 0.10.2
FABRIC_LOADER_VERSION: 0.13.1
```
!!! note
See the [Working with mods and plugins](../../mods-and-plugins/index.md) section to set up Fabric mods and configuration.
## Fabric API
As [mentioned on the Fabric download page](https://fabricmc.net/use/installer/), most mods will require the Fabric API mod to be installed. That can be easily done by utilizing [the Modrinth downloads feature](../../mods-and-plugins/modrinth.md), such as adding this to the `environment` of a compose file service:
```yaml
TYPE: FABRIC
MODRINTH_PROJECTS: |
fabric-api
```
## Alternate launcher
If you wish to use an alternative launcher you can:
- Provide the path to a custom launcher jar available to the container with `FABRIC_LAUNCHER`, relative to `/data` (such as `-e FABRIC_LAUNCHER=fabric-server-custom.jar`)
- Provide the URL to a custom launcher jar with `FABRIC_LAUNCHER_URL` (such as `-e FABRIC_LAUNCHER_URL=http://HOST/fabric-server-custom.jar`)
## Force re-install
If the Fabric launcher jar becomes corrupted you can temporarily set FABRIC_FORCE_REINSTALL to "true" to have it re-installed on next startup.
A [Forge server](http://www.minecraftforge.net/) can be automatically downloaded, upgraded, and run by setting the environment variable `TYPE` to "FORGE".
!!! note "A note from the installer"
> Please do not automate the download and installation of Forge.
Our efforts are supported by ads from the download page.
If you MUST automate this, please consider supporting the project through <https://www.patreon.com/LexManos/>
Since my project also relies on donations, please pass it along and consider contributing to the Patreon above.
!!! example
```
docker run -e TYPE=FORGE ...
```
or in a compose file
```yaml
environment:
TYPE: FORGE
```
The overall version is specified by `VERSION`, [as described in the section above](../../versions/minecraft.md) and provides the same benefits of upgrading as new versions are released. By default, the recommended version of Forge for that Minecraft version will be selected. The latest version can be selected instead by setting the environment variable `FORGE_VERSION` to "latest". You can also choose a specific Forge version by setting `FORGE_VERSION` with that version, such as "14.23.5.2854".
!!! example
```
docker run -e TYPE=FORGE -e VERSION=1.12.2 -e FORGE_VERSION=14.23.5.2854 ...
```
or in a compose file
```yaml
environment:
TYPE: FORGE
VERSION: "1.12.2"
FORGE_VERSION: "14.23.5.2854"
```
To use a pre-downloaded Forge installer, place it in a location mounted into the container and specify the container path with `FORGE_INSTALLER`. To download a Forge installer from a custom location, such as your own file repository, specify the URL with `FORGE_INSTALLER_URL`.
In both of the cases above, there is no need for the `VERSION` or `FORGE_VERSION` variables.
!!! note
If an error occurred while installing Forge, it might be possible to resolve by temporarily setting `FORGE_FORCE_REINSTALL` to "true". Be sure to remove that variable after successfully starting the server.
URLs configurable via environment variables:
- `FORGE_PROMOTIONS_URL`: default is https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json
- `FORGE_MAVEN_REPO_URL`: default is https://maven.minecraftforge.net
## Alternatives
### NeoForge
Support for [NeoForge](https://neoforged.net/) is also provided. A NeoForge server can be automatically managed by setting `TYPE` to "NEOFORGE". `VERSION` specifies the Minecraft version and `NEOFORGE_VERSION` can be set to select a specific version, "latest", or "beta". By default, the latest, non-beta NeoForge version available for the requested Minecraft version will be used.
!!! example
```
docker run -e TYPE=NEOFORGE -e VERSION=1.20.1 -e NEOFORGE_VERSION=47.1.79 ...
```
or in a compose file
```yaml
environment:
TYPE: NEOFORGE
VERSION: "1.20.4"
NEOFORGE_VERSION: "beta"
```
### Cleanroom
[Cleanroom](https://github.com/CleanroomMC/Cleanroom) isn't fully automated, but can be utilized by...
1. choose the desired release at https://github.com/CleanroomMC/Cleanroom/releases
2. grab the link to the `*-installer.jar` file in that release
3. with `TYPE` set to "FORGE", set `FORGE_INSTALLER_URL` to the installer jar's link
A [Magma](https://magmafoundation.org/) server, which is a combination of Forge and PaperMC, can be used with
-e TYPE=MAGMA
!!! note
The Magma project has been terminated ([original link died](https://git.magmafoundation.org/magmafoundation/magma-1-20-x/-/commit/4e7abe37403c47d09b74b77bcfc26a19b18f5891), [alternate statement on their discord](https://discord.com/channels/612695539729039411/647287352833605662/1174412642962649198) ). Please use Magma Maintained for 1.12.2, 1.18.2 and 1.19.3, or Ketting for 1.20.1+.
There are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2", "1.16.5", etc.
### Magma Maintained
A [Magma Maintained](https://github.com/magmamaintained/) server, which is a alternative project of Magma, can be used with
-e TYPE=MAGMA_MAINTAINED
!!! note
There are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2", "1.18.2", "1.19.3", or "1.20.1".
In addition, `FORGE_VERSION` and `MAGMA_MAINTAINED_TAG` must be specified. You can find the supported `FORGE_VERSION` and `MAGMA_MAINTAINED_TAG` in a releases page for each repositories.
### Ketting
A [Ketting](https://github.com/kettingpowered/Ketting-1-20-x) server, which is an alternative project of Magma 1.20.1+, can be used with
-e TYPE=KETTING
There are limited base versions supported, so you will also need to set `VERSION`, such as "1.20.1" or later.
`FORGE_VERSION` and `KETTING_VERSION` may be specified; however, they will be defaulted by the [Ketting launcher](https://github.com/kettingpowered/kettinglauncher) otherwise.
Available Ketting Versions may be found at [https://reposilite.c0d3m4513r.com/#/Ketting-Server-Releases/org/kettingpowered/server/forge](https://reposilite.c0d3m4513r.com/#/Ketting-Server-Releases/org/kettingpowered/server/forge).
The Version structure is `MinecraftVersion-ForgeVersion-KettingVersion` (e.g. `1.20.1-47.2.20-0.1.4` is for Minecraft `1.20.1`, Forge `47.2.20` and Ketting `0.1.4`).
### Mohist
A [Mohist](https://github.com/MohistMC/Mohist) server can be used with
-e TYPE=MOHIST
!!! note
There are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2"
By default the latest build will be used; however, a specific build number can be selected by setting `MOHIST_BUILD`, such as
-e VERSION=1.16.5 -e MOHIST_BUILD=374
### Youer
A [Youer](https://github.com/MohistMC/Youer) server can be used with
-e TYPE=YOUER
!!! note
There are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2"
By default the latest build will be used; however, a specific build number can be selected by setting `MOHIST_BUILD`, such as
-e VERSION=1.16.5 -e MOHIST_BUILD=374
### Banner
A [Banner](https://github.com/MohistMC/Banner) server can be used with
-e TYPE=BANNER
!!! note
There are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2"
By default the latest build will be used; however, a specific build number can be selected by setting `MOHIST_BUILD`, such as
-e VERSION=1.16.5 -e MOHIST_BUILD=374
### Catserver
A [Catserver](http://catserver.moe/) type server can be used with
-e TYPE=CATSERVER
> **NOTE** Catserver only provides a single release stream, so `VERSION` is ignored
### Arclight
A [Arclight](https://arclight.izzel.io/) type server can be used with
Enable SpongeVanilla server mode by adding a `-e TYPE=SPONGEVANILLA` to your command-line.
By default the container will run the latest `STABLE` version.
If you want to run a specific version, you can add `-e SPONGEVERSION=1.11.2-6.1.0-BETA-19` to your command-line.
Beware that current [Sponge](https://www.spongepowered.org) `STABLE` versions for Minecraft 1.12 require using [the Java 8 tag](../../versions/java.md):
``` shell
docker run -d -v /path/on/host:/data -e TYPE=SPONGEVANILLA \
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server:java8-multiarch
```
You can also choose to use the `EXPERIMENTAL` branch.
A [Limbo](https://github.com/LOOHP/Limbo) server can be run by setting `TYPE` to `LIMBO`.
Configuration options with defaults:
- `LIMBO_BUILD`=LATEST
The `VERSION` will be ignored so locate the appropriate value from [here](https://ci.loohpjames.com/job/Limbo/) to match the version expected by clients.
- `FORCE_REDOWNLOAD`=false
- `LIMBO_SCHEMA_FILENAME`=default.schem
- `LEVEL`="Default;${LIMBO_SCHEMA_NAME}"
!!! note
Instead of using format codes in the MOTD, Limbo requires [JSON chat content](https://minecraft.wiki/w/Raw_JSON_text_format#Java_Edition). If a plain string is provided, which is the default, then it gets converted into the required JSON structure.
## NanoLimbo
A [NanoLimbo](https://github.com/BoomEaro/NanoLimbo) server can be run by setting `TYPE` to `NANOLIMBO`.
Note: it is a fork of the original [NanoLimbo](https://github.com/Nan1t/NanoLimbo) made by Nan1t
An alternate Limbo server
## Crucible
A [Crucible](https://github.com/CrucibleMC/Crucible) server can be run by setting `TYPE` to `CRUCIBLE`.
Configuration options with defaults:
- `CRUCIBLE_RELEASE`=latest
Crucible is only available for 1.7.10, so be sure to set `VERSION=1.7.10`.
## Custom
To use a custom server jar or class files, set `TYPE` to "CUSTOM" and continue with one of the following options:
The custom jar to be used can be set with `CUSTOM_SERVER` as either a URL to download or the path to a file within the container.
Alternatively, the final `-jar` invocation can be replaced by setting `CUSTOM_JAR_EXEC` to "`-cp <classpath> <classname>`" or "`-jar <jar file>`" form, such as
A [PaperMC server](https://papermc.io/) can be automatically downloaded, upgraded, and run by setting the environment variable TYPE to "PAPER".
By default, the container will find and download the latest build for the `VERSION` chosen. If `VERSION` is not specified, then the latest Minecraft version released by PaperMC is selected. Along with a specific `VERSION`, a specific Paper build can be selected by setting the environment variable `PAPER_BUILD`.
To allow for the selection of experimental builds, set `PAPER_CHANNEL` to "experimental", otherwise only release/default channel builds are selected.
!!! example
Using `docker run` command line
```
docker run ... -e TYPE=PAPER ...
docker run ... -e TYPE=PAPER -e VERSION=1.20.6 ...
docker run ... -e TYPE=PAPER -e VERSION=1.20.6 -e PAPER_BUILD=140 ...
docker run ... -e TYPE=PAPER -e PAPER_CHANNEL=experimental ...
```
Using a compose file:
```yaml
environment:
TYPE: PAPER
```
```yaml
environment:
TYPE: PAPER
VERSION: 1.20.6
PAPER_BUILD: 140
```
```yaml
environment:
TYPE: PAPER
PAPER_CHANNEL: experimental
```
!!! tip
If you see the following error, it likely means you need to set the env var `PAPER_CHANNEL` to "experimental"
```
No build found for version 1.21 with channel 'default'
```
If you are hosting your own copy of Paper you can override the download URL with `PAPER_DOWNLOAD_URL=<url>`.
If you have attached a host directory to the `/data` volume, then you can install plugins via the `plugins` subdirectory. You can also [attach a `/plugins` volume](../../mods-and-plugins/index.md#optional-plugins-mods-and-config-attach-points). If you add plugins while the container is running, you'll need to restart it to pick those up.
[You can also auto-download plugins using `SPIGET_RESOURCES`.](../../mods-and-plugins/spiget.md)
## Alternatives
### Pufferfish
A [Pufferfish](https://github.com/pufferfish-gg/Pufferfish) server, which is "a highly optimized Paper fork designed for large servers requiring both maximum performance, stability, and "enterprise" features."
-e TYPE=PUFFERFISH
!!! note
The `VERSION` variable is used to select branch latest, 1.18, or 1.17. Use PUFFERFISH_BUILD to really select the SERVER VERSION number.
Extra variables:
- `PUFFERFISH_BUILD=lastSuccessfulBuild` : set a specific Pufferfish build to use. Example: selecting build 47 => 1.18.1, or build 50 => 1.18.2 etc
- `FORCE_REDOWNLOAD=false` : set to true to force the located server jar to be re-downloaded
- `USE_FLARE_FLAGS=false` : set to true to add appropriate flags for the built-in [Flare](https://blog.airplane.gg/flare) profiler
### Purpur
A [Purpur](https://purpurmc.org/) server, which is "a drop-in replacement for Paper servers designed for configurability and new, fun, exciting gameplay features."
-e TYPE=PURPUR
!!! note
The `VERSION` variable is used to lookup a build of Purpur to download
Extra variables:
- `PURPUR_BUILD=LATEST` : set a specific Purpur build to use
- `FORCE_REDOWNLOAD=false` : set to true to force the located server jar to be re-downloaded
- `USE_FLARE_FLAGS=false` : set to true to add appropriate flags for the built-in [Flare](https://blog.airplane.gg/flare) profiler
- `PURPUR_DOWNLOAD_URL=<url>` : set URL to download Purpur from custom URL.
### Leaf
A [Leaf server](https://www.leafmc.one/) is a Paper fork focused on performance improvements and low-level optimizations for smoother gameplay.
To use a Leaf server, set the environment variable `TYPE` to `"LEAF"`.
-e TYPE=LEAF
!!! note
The `VERSION` variable is used to select the Minecraft version to run.
To specify a particular Leaf build, use `LEAF_BUILD`.
By default the latest build will be used; however, a specific build number can be selected by setting `LEAF_BUILD`, such as
-e VERSION=1.21.4 -e LEAF_BUILD=441
### Folia
A [Folia server](https://papermc.io/software/folia) can be used by setting the environment variable `TYPE` to "FOLIA".
By default, the container will run the latest experimental build of [Folia server](https://papermc.io/downloads), but you can also choose to run a specific build with `-e FOLIABUILD=26`. The release channel can be changed with the variable `FOLIA_CHANNEL`; however, only experimental builds are available at this time.
!!! example
Using `docker run`
```
docker run -d -v /path/on/host:/data \
-e TYPE=FOLIA \
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
```
If you are hosting your own copy of Folia you can override the download URL with `FOLIA_DOWNLOAD_URL=<url>`.
If you have attached a host directory to the `/data` volume, then you can install plugins via the `plugins` subdirectory. You can also [attach a `/plugins` volume](../../mods-and-plugins/index.md#optional-plugins-mods-and-config-attach-points). If you add plugins while the container is running, you'll need to restart it to pick those up.
[You can also auto-download plugins using `SPIGET_RESOURCES`.](../../mods-and-plugins/spiget.md)
!!! note
The Folia type inherits from the Paper type. Paper's variables will override the Folia ones.
## Extra config
- `SKIP_DOWNLOAD_DEFAULTS`: when set to "true" startup will entirely skip checking for default Paper/Bukkit/Spigot config files to download
Enable [Quilt server](https://quiltmc.org/) mode by adding a `-e TYPE=QUILT` to your command-line.
```
docker run -d -v /path/on/host:/data \
-e TYPE=QUILT \
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
```
By default, the container will install the latest [quilt server launcher](https://quiltmc.org/install/server/), using the latest [quilt-installer](https://github.com/QuiltMC/quilt-installer) against the minecraft version you have defined with `VERSION` (defaulting to the latest vanilla release of the game).
A specific loader or installer version other than the latest can be requested using `QUILT_LOADER_VERSION` and `QUILT_INSTALLER_VERSION` respectively, such as:
```
docker run -d -v /path/on/host:/data ... \
-e TYPE=QUILT \
-e QUILT_LOADER_VERSION=0.16.0 \
-e QUILT_INSTALLER_VERSION=0.4.1
```
!!! note
If you wish to use an alternative launcher you can:
- Provide the path to a custom launcher jar available to the container with `QUILT_LAUNCHER`, relative to `/data` (such as `-e QUILT_LAUNCHER=quilt-server-custom.jar`)
- Provide the URL to a custom launcher jar with `QUILT_LAUNCHER_URL` (such as `-e QUILT_LAUNCHER_URL=http://HOST/quilt-server-custom.jar`)
See the [Working with mods and plugins](../../mods-and-plugins/index.md) section to set up Quilt mods and configuration.
The variables listed on this page are manually documented and may be out-of-date or inaccurate.
All other documentation pages are actively maintained, so please use the search box above to find the desired topic.
### General options
<table>
<thead>
<tr>
<th>NAME</th>
<th>DESCRIPTION</th>
<th>DEFAULT</th>
<th>REQUIRED</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>UID</code></td>
<td>The linux user id to run as</td>
<td><code>1000</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>GID</code></td>
<td>The linux group id to run as</td>
<td><code>1000</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>MEMORY</code></td>
<td>The image declares an initial and maximum Java memory-heap limit of 1 GB.</td>
<td><code>1G</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>INIT_MEMORY</code></td>
<td>Independently sets the initial heap size</td>
<td><code>1G</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>MAX_MEMORY</code></td>
<td>independently sets the max heap size</td>
<td><code>1G</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>TZ</code></td>
<td>You can configure the timezone to match yours by setting the TZ environment variable.
alternatively, you can mount: <code>/etc/localtime:/etc/localtime:ro
/etc/timezone:/etc/timezone:ro</code>
</td>
<td><code>UTC</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>ENABLE_ROLLING_LOGS</code></td>
<td>By default the vanilla log file will grow without limit. The logger can be reconfigured to use a rolling log files strategy by setting this to <code>true</code></td>
<td><code>false</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>ENABLE_JMX</code></td>
<td>To enable remote JMX, such as for profiling with VisualVM or JMC, add the environment variable ENABLE_JMX=true</td>
<td><code>false</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>JMX_HOST</code></td>
<td>If JMX is enabled, set JMX_HOST to the IP/host running the Docker container, and add a port forwarding of TCP port 7091</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>USE_AIKAR_FLAGS</code></td>
<td><a href="https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/">Aikar has done some research</a> into finding the optimal JVM flags for GC tuning, which becomes more important as more users are connected concurrently</td>
<td><code>false</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>USE_MEOWICE_FLAGS</code></td>
<td><a href="https://github.com/MeowIce/meowice-flags?tab=readme-ov-file#why-would-i-have-to-switch-">MeowIce has created an updated set of JVM flags</a> based on Aikar's flags but with support for optimizations for Java 17 and above</td>
<td><code>false</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>USE_MEOWICE_GRAALVM_FLAGS</code></td>
<td>enables MeowIce's flags for GraalVM if USE_MEOWICE_GRAALVM_FLAGS is TRUE</td>
<td><code>true</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>JVM_OPTS</code></td>
<td>General JVM options can be passed to the Minecraft Server invocation by passing a <code>JVM_OPTS</code> environment variable. The JVM requires -XX options to precede -X options, so those can be declared in <code>JVM_XX_OPTS</code>. Both variables are space-delimited, raw JVM arguments</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>JVM_XX_OPTS</code></td>
<td>General JVM options can be passed to the Minecraft Server invocation by passing a <code>JVM_OPTS</code> environment variable. The JVM requires -XX options to precede -X options, so those can be declared in <code>JVM_XX_OPTS</code>. Both variables are space-delimited, raw JVM arguments</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>JVM_DD_OPTS</code></td>
<td>As a shorthand for passing several system properties as -D arguments, you can instead pass a comma separated list of name=value or name:value pairs with JVM_DD_OPTS. (The colon syntax is provided for management platforms like Plesk that don't allow = inside a value.)</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>EXTRA_ARGS</code></td>
<td>Arguments that would usually be passed to the jar file (those which are written after the filename)</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>LOG_TIMESTAMP </code></td>
<td>To include the timestamp with each log set to <code>true</code></td>
<td><code>false</code></td>
<td>⬜️</td>
</tr>
</tbody>
</table>
### Server
<table>
<thead>
<tr>
<th>NAME</th>
<th>DESCRIPTION</th>
<th>DEFAULT</th>
<th>REQUIRED</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>TYPE</code></td>
<td>The server <a href="../types-and-platforms/">type</a></td>
<td><code>VANILLA</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>EULA</code></td>
<td>You <strong>MUST</strong> set this to <code>true</code></td>
<td><code> </code></td>
<td>✅</td>
</tr>
<tr>
<td><code>VERSION</code></td>
<td>The minecraft version</td>
<td><code>LATEST</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>MOTD</code></td>
<td>Set the server log in message.</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>DIFFICULTY</code></td>
<td>The difficulty level. Available values: <code>peaceful</code>,<code>easy</code>,<code>normal</code>,<code>hard</code></td>
<td><code>easy</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>ICON</code></td>
<td>The url or file path for the icon image to use for the server. It will be downloaded, scaled, and converted to the proper format.</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>OVERRIDE_ICON</code></td>
<td>The server icon which has been set doesn't get overridden by default. Set this to <code>TRUE</code> to override the icon</td>
<td><code>FALSE</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>MAX_PLAYERS</code></td>
<td>The maximum number of players that can join the server.</td>
<td><code>20</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>MAX_WORLD_SIZE</code></td>
<td>The maximum possible size in blocks, expressed as a radius.</td>
<td>Allows server to announce when a player gets an achievement.</td>
<td><code>true</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>ENABLE_COMMAND_BLOCK</code></td>
<td>Enables the command blocks.</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>FORCE_GAMEMODE</code></td>
<td>Force players to join in the default game mode.</td>
<td><code>false</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>GENERATE_STRUCTURES</code></td>
<td>Defines whether structures (such as villages) will be generated.</td>
<td><code>true</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>HARDCORE</code></td>
<td>If set to <code>true</code>, players will be set to spectator mode if they die.</td>
<td><code>false</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>SNOOPER_ENABLED</code></td>
<td>If set to false, the server will not send data to snoop.minecraft.net server.</td>
<td><code>true</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>MAX_BUILD_HEIGHT</code></td>
<td>The maximum height in which building is allowed. Terrain may still naturally generate above a low height limit.</td>
<td><code>256</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>SPAWN_ANIMALS</code></td>
<td>Determines if animals will be able to spawn.</td>
<td><code>true</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>SPAWN_MONSTERS</code></td>
<td>Determines if monsters will be spawned.</td>
<td><code>true</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>SPAWN_NPCS</code></td>
<td>Determines if villagers will be spawned.</td>
<td><code>true</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>SPAWN_PROTECTION</code></td>
<td>Sets the area that non-ops can not edit (0 to disable)</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>VIEW_DISTANCE</code></td>
<td>Sets the amount of world data the server sends the client, measured in chunks in each direction of the player (radius, not diameter). It determines the server-side viewing distance.</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>SEED</code></td>
<td>Sets the seed to create the Minecraft world. If you use a negative number, make sure that it is in quotes.</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>MODE</code></td>
<td>Minecraft servers are configured to run in Survival mode by default. You can change the mode using MODE where you can either provide the <a href="http://minecraft.wiki/Game_mode#Game_modes">standard numerical values</a> or the shortcut values:<br />
<ul>
<li>creative</li>
<li>survival</li>
<li>adventure</li>
<li>spectator(minecraft 1.8 or later)</li>
</ul></td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>PVP</code></td>
<td>By default, servers are created with player-vs-player (PVP) mode enabled.</td>
<td><code>true</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>LEVEL_TYPE</code></td>
<td>By default, a standard world is generated with hills, valleys, water, etc. A different level type can be configured by setting LEVEL_TYPE to <a href="https://minecraft.wiki/w/Server.properties#level-type">an expected type listed here</a>.
</td>
<td><code>minecraft:default</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>GENERATOR_SETTINGS</code></td>
<td>For some of the level types, <code>GENERATOR_SETTINGS</code> can be used to further customize the world generation <a href="https://minecraft.wiki/w/Server.properties#generator-settings">as described here</a>.</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>LEVEL</code></td>
<td>You can either switch between world saves or run multiple containers with different saves by using the LEVEL option</td>
<td><code>world</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>ONLINE_MODE</code></td>
<td>By default, server checks connecting players against Minecraft's account database. If you want to create an offline server or your server is not connected to the internet, you can disable the server to try connecting to minecraft.net to authenticate players</td>
<td><code>true</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>ALLOW_FLIGHT</code></td>
<td>Allows users to use flight on your server while in Survival mode, if they have a mod that provides flight installed.</td>
<td><code>FALSE</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>SERVER_NAME</code></td>
<td>The server name</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>SERVER_PORT</code></td>
<td>Only change this value if you know what you're doing. It is only needed when using host networking and it is rare that host networking should be used.</td>
<td>If you would like to docker attach to the Minecraft server console with color and interactive capabilities, then set to <code>true</code></td>
<td><code>false</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>STOP_SERVER_ANNOUNCE_DELAY</code></td>
<td>To allow time for players to finish what they're doing during a graceful server shutdown, set <code>STOP_SERVER_ANNOUNCE_DELAY</code> to a number of seconds to delay after an announcement is posted by the server.</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>PROXY</code></td>
<td>You may configure the use of an HTTP/HTTPS proxy by passing the proxy's URL</td>
<td><code>false</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>CONSOLE</code></td>
<td>Some older versions (pre-1.14) of Spigot required <code>--noconsole</code> to be passed when detaching stdin</td>
<td><code>TRUE</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>GUI</code></td>
<td>Some older servers get confused and think that the GUI interface is enabled.</td>
<td><code>TRUE</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>STOP_DURATION</code></td>
<td>When the container is signalled to stop, the Minecraft process wrapper will attempt to send a "stop" command via RCON or console and waits for the process to gracefully finish.</td>
<td><code>60</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>SETUP_ONLY</code></td>
<td>If you are using a host-attached data directory, then you can have the image setup the Minecraft server files and stop prior to launching the server process by setting this to <code>true</code></td>
<td><code>false</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>USE_FLARE_FLAGS</code></td>
<td>To enable the JVM flags required to fully support the <a href="https://blog.airplane.gg/flare">Flare profiling suite</a>.</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>USE_SIMD_FLAGS</code></td>
<td>Support for optimized SIMD operation</td>
<td><code>false</code></td>
<td>⬜️</td>
</tr>
<!-- <tr>
<td><code></code></td>
<td></td>
<td><code></code></td>
<td>⬜️</td>
</tr> -->
</tbody>
</table>
### Custom resource pack
<table>
<thead>
<tr>
<th>NAME</th>
<th>DESCRIPTION</th>
<th>DEFAULT</th>
<th>REQUIRED</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>RESOURCE_PACK</code></td>
<td>A link to a custom resource pack</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>RESOURCE_PACK_SHA1</code></td>
<td>The checksum for the custom resource pack</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>RESOURCE_PACK_ENFORCE</code></td>
<td>Enforce the resource pack on clients</td>
<td><code>FALSE</code></td>
<td>⬜️</td>
</tr>
</tbody>
</table>
### Whitelist
<table>
<thead>
<tr>
<th>NAME</th>
<th>DESCRIPTION</th>
<th>DEFAULT</th>
<th>REQUIRED</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>ENABLE_WHITELIST</code></td>
<td>Enable the whitelist to manually manage the whitelist</td>
<td><code>false</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>WHITELIST</code></td>
<td>A list of usernames and/or UUIDs separated by comma</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>WHITELIST_FILE</code></td>
<td>A url or file path to a whitelist <code>json</code> formatted file.</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>OVERRIDE_WHITELIST</code></td>
<td>Enforce regeneration of the whitelist on each server startup.</td>
<td><code>false</code></td>
<td>⬜️</td>
</tr>
</tbody>
</table>
### RCON
<table>
<thead>
<tr>
<th>NAME</th>
<th>DESCRIPTION</th>
<th>DEFAULT</th>
<th>REQUIRED</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>ENABLE_RCON</code></td>
<td>Enable/disable RCON support; however, be aware that disabling RCON will remove and limit some features, such as interactive and color console support.</td>
<td><code>true</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>RCON_PASSWORD</code></td>
<td>You <strong>MUST</strong> change this value</td>
<td><code>Randomly generated</code></td>
<td>✅</td>
</tr>
<tr>
<td><code>RCON_PORT</code></td>
<td>The port for RCON</td>
<td><code>25575</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>BROADCAST_RCON_TO_OPS</code></td>
<td>Sets broadcast-rcon-to-ops server property</td>
<td><code>false</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>RCON_CMDS_STARTUP</code></td>
<td>RCON commands to execute when the server starts.</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>RCON_CMDS_ON_CONNECT</code></td>
<td>RCON commands to execute whenever a client connects to the server.</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>RCON_CMDS_FIRST_CONNECT</code></td>
<td>RCON commands to execute on the first client connection to the server.</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>RCON_CMDS_ON_DISCONNECT</code></td>
<td>RCON commands to execute whenever a client disconnects from the server.</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>RCON_CMDS_LAST_DISCONNECT</code></td>
<td>RCON commands to execute when the last client disconnects from the server.</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
</tbody>
</table>
### Auto-Pause
!!! note
Autopause is not compatible with `EXEC_DIRECTLY=true` and the two cannot be set together.
<table>
<thead>
<tr>
<th>NAME</th>
<th>DESCRIPTION</th>
<th>DEFAULT</th>
<th>REQUIRED</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>ENABLE_AUTOPAUSE</code></td>
<td>Enable the Autopause functionality</td>
<td><code>FALSE</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>AUTOPAUSE_TIMEOUT_EST</code></td>
<td>describes the time between the last client disconnect and the pausing of the process</td>
<td><code>3600</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>AUTOPAUSE_TIMEOUT_INIT</code></td>
<td>describes the time between server start and the pausing of the process, when no client connects in-between</td>
<td><code>600</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>AUTOPAUSE_TIMEOUT_KN</code></td>
<td>describes the time between knocking of the port (e.g. by the main menu ping) and the pausing of the process, when no client connects in-between</td>
<td><code>120</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>AUTOPAUSE_PERIOD</code></td>
<td>describes period of the daemonized state machine, that handles the pausing of the process</td>
<td><code>10</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>AUTOPAUSE_KNOCK_INTERFACE</code></td>
<td>Describes the interface passed to the knockd daemon. If the default interface does not work, run the ifconfig command inside the container and derive the interface receiving the incoming connection from its output. The passed interface must exist inside the container. Using the loopback interface (lo) does likely not yield the desired results.</td>
<td><code>eth0</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>DEBUG_AUTOPAUSE</code></td>
<td>Adds additional debugging output for AutoPause</td>
<td><code>false</code></td>
<td>⬜️</td>
</tr>
</tbody>
</table>
### Auto-Stop
!!! note
AutoStop function is incompatible with the Autopause functionality, as they basically cancel out each other.
<table>
<thead>
<tr>
<th>NAME</th>
<th>DESCRIPTION</th>
<th>DEFAULT</th>
<th>REQUIRED</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>ENABLE_AUTOSTOP</code></td>
<td>Enable the AutoStop functionality</td>
<td><code>FALSE</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>AUTOSTOP_TIMEOUT_EST</code></td>
<td>describes the time between the last client disconnect and the stopping of the server</td>
<td><code>3600</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>AUTOSTOP_TIMEOUT_INIT</code></td>
<td>describes the time between server start and the stopping of the server, when no client connects in-between</td>
<td><code>1800</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>AUTOSTOP_PERIOD</code></td>
<td>describes period of the daemonized state machine, that handles the stopping of the serve</td>
<td><code>10</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>DEBUG_AUTOSTOP</code></td>
<td>Adds additional logging for AutoStop</td>
<td><code>false</code></td>
<td>⬜️</td>
</tr>
</tbody>
</table>
### CurseForge
!!! tip
Refer to the [main documentation page](types-and-platforms/mod-platforms/auto-curseforge.md) for more details and up-to-date information.
<table>
<thead>
<tr>
<th>NAME</th>
<th>DESCRIPTION</th>
<th>DEFAULT</th>
<th>REQUIRED</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>CF_API_KEY</code></td>
<td><strong>YOUR</strong> CurseForge (Eternal) API Key.</td>
<td><code></code></td>
<td>✅</td>
</tr>
<tr>
<td><code>CF_API_KEY_FILE</code></td>
<td>A path to a file inside of container that contains <strong>YOUR</strong> CurseForge (Eternal) API Key.</td>
<td><code></code></td>
<td>✅</td>
</tr>
<tr>
<td><code>CF_PAGE_URL</code></td>
<td>Pass a page URL to the modpack or a specific file</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>CF_SLUG</code></td>
<td>Instead of a URL, the modpack slug can be provided.</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>CF_FILE_ID</code></td>
<td>The mod curseforge numerical ID.</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>CF_FILENAME_MATCHER</code></td>
<td>Specify a substring to match the desired filename</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>CF_EXCLUDE_INCLUDE_FILE</code></td>
<td>Global and per modpack exclusions can be declared in a JSON file and referenced with this variable. <br /><br />By default, the <a href="https://github.com/itzg/docker-minecraft-server/blob/master/files/cf-exclude-include.json">file bundled with the image</a> will be used, but can be disabled by setting this to an empty string. The schema of this file is <a href="https://github.com/itzg/mc-image-helper#excludeinclude-file-schema">documented here</a>.</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>CF_EXCLUDE_MODS</code></td>
<td>Mods can be excluded by passing a comma or space delimited list of project slugs or IDs</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>CF_FORCE_INCLUDE_MODS</code></td>
<td>Mods can be included by passing a comma or space delimited list of project slugs or IDs</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>CF_FORCE_SYNCHRONIZE</code></td>
<td>Forces the excludes/includes to be re-evaluated</td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>CF_SET_LEVEL_FROM</code></td>
<td>Some modpacks come with world/save data via a worlds file and/or the overrides provided with the modpack. Either approach can be selected to set the LEVEL to the resulting saves directory by setting this to either:
<ul>
<li>WORLD_FILE</li>
<li>OVERRIDES</li>
</ul></td>
<td><code></code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>CF_PARALLEL_DOWNLOADS</code></td>
<td>specify how many parallel mod downloads to perform</td>
<td><code>4</code></td>
<td>⬜️</td>
</tr>
<tr>
<td><code>CF_OVERRIDES_SKIP_EXISTING</code></td>
<td>if set, files in the overrides that already exist in the data directory are skipped. world data is always skipped, if present.</td>
1. Why no arm64 for Java 17 Alpine? That is because the base images, such as [elipse-temurin](https://hub.docker.com/_/eclipse-temurin/tags?page=&page_size=&ordering=&name=17-jre-alpine) do not provide support for that. Use the Ubuntu based images instead.
2. Short-term variant, subject to deprecation upon next version introduction
3. Based on the [Oracle GraalMV images](https://blogs.oracle.com/java/post/new-oracle-graalvm-container-images), which as of JDK 17, are now under the [GraalVM Free License](https://blogs.oracle.com/java/post/graalvm-free-license) incorporating what used to be known as the GraalVM Enterprise.
4. This version of Java is [recommended for PaperMC 1.16.5](https://docs.papermc.io/paper/getting-started/#requirements)
!!! example "Example using java8"
With docker run command-line
```
docker run -it -e EULA=true itzg/minecraft-server:java8
```
or in a compose file
```yaml
services:
mc:
image: itzg/minecraft-server:java8
```
!!! note "Latest"
The "latest" tag shifts to include not only the latest features and bug fixes, but also the latest Java version that Mojang requires for the latest Minecraft version.
!!! tip "Class File Version"
If the Minecraft startup is logging an error about a "class file version", then refer [to this table](https://javaalmanac.io/bytecode/versions/) to identify the JDK/Java version corresponding to each class file version.
### Release versions
Since the tags referenced above will shift as the newest image build brings in new features and bug fixes, released variants of those can also be used to pin a specific build of the image.
The syntax of released image tags is:
itzg/minecraft-server:<release>-<java tag>
where `java tag` still refers to the first column of the table above and `release` refers to [one of the image releases](https://github.com/itzg/docker-minecraft-server/releases).
!!! example
For example, the 2024.4.0 release of the Java 17 image would be
```
itzg/minecraft-server:2024.4.0-java17
```
### Stable image tag
The `stable` image tag combines the benefits of `latest` and [release versions](#release-versions) since it shifts to refer to the most recently released version. There is also a per-variant stable tag, formatted as `stable-{variant}`.
## Version compatibilities
[This section in the Minecraft wiki](https://minecraft.wiki/w/Tutorials/Update_Java#Why_update?) lists out versions of **vanilla** Minecraft versions and the corresponding Java version that is required.
### Class file version 65.0
If encountering a startup failure similar to the following examples, then ensure that the latest image has been re-pulled to use a Java 21. Alternatively, set the image tag specifically to `itzg/minecraft-server:java21`.
> Exception in thread "ServerMain" java.lang.UnsupportedClassVersionError: org/bukkit/craftbukkit/Main has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0
or
> Error: LinkageError occurred while loading main class net.minecraft.bundler.Main
java.lang.UnsupportedClassVersionError: net/minecraft/bundler/Main has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0
### Forge versions
Forge and its mods sometimes utilize non-public APIs of the JVM and as such are suspceptible to becoming broken with newer Java versions.
#### Java 21
Some mods even up to Minecraft 1.21 require Java 17 and will not run on the latest Java version. If you see an error like the following then be sure to explicitly use a Java 17 tagged image:
at MC-BOOTSTRAP/org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer.MixinPreProcessorStandard.transformMethod(MixinPreProcessorStandard.java:754)
```
#### Java 8
For Forge versions less than 1.18, you _must_ use the `java8-multiarch` (or other java8) image tag.
In general, if you see the following line in a server startup failure, then it means you need to be using Java 8 instead of the latest image Java version:
```
Caused by: java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader
cannot be cast to class java.net.URLClassLoader
```
Forge also doesn't support openj9 JVM implementation.
## Deprecated Image Tags
The following image tags have been deprecated and are no longer receiving updates:
- adopt13
- adopt14
- adopt15
- openj9-nightly
- multiarch-latest
- java16-openj9
- java17-graalvm-ce
- java17-openj9
- java19
- java20-graalvm, java20, java20-alpine
- java23-*
- java24, java24-graalvm
- java8-multiarch is still built and pushed, but please move to java8 instead
Information about the image tags is available programmatically at <https://raw.githubusercontent.com/itzg/docker-minecraft-server/refs/heads/master/images.json>
This Docker image provides an easily configurable Elasticsearch node. Via port mappings, it is easy to create an arbitrarily sized cluster of nodes. As long as the versions match, you can mix-and-match "real" Elasticsearch nodes with container-ized ones.
# NOTE for use on Linux hosts
Elasticsearch 5.x requires that the virtual memory mmap count is set sufficiently for stable,
production use. [Refer to this guide for more information](https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html).
# Basic Usage
To start an Elasticsearch data node that listens on the standard ports on your host's network interface:
docker run -d -p 9200:9200 -p 9300:9300 itzg/elasticsearch
You'll then be able to connect to the Elasticsearch HTTP interface to confirm it's alive:
As you can see, there is also a Kibana instance included and available at port 5601.
# Health Checks
This container declares a [HEALTHCHECK](https://docs.docker.com/engine/reference/builder/#/healthcheck) that queries the `_cat/health`
endpoint for a quick, one-line gauge of health every 30 seconds.
The current health of the container is shown in the `STATUS` column of `docker ps`, such as
Up 14 minutes (healthy)
You can also check the history of health checks from `inspect`, such as:
```
> docker inspect -f "{{json .State.Health}}" es
{"Status":"healthy","FailingStreak":0,"Log":[...
```
# Configuration Summary
## Ports
*`9200` - HTTP REST
*`9300` - Native transport
## Volumes
*`/data` - location of `path.data`
*`/conf` - location of `path.conf`
# Configuration Details
The following configuration options are specified using `docker run` environment variables (`-e`) like
docker run ... -e NAME=VALUE ... itzg/elasticsearch
Since Docker's `-e` settings are baked into the container definition, this image provides an extra feature to change any of the settings below for an existing container. Either create/edit the file `env` in the `/conf` volume mapping or edit within the running container's context using:
docker exec -it CONTAINER_ID vi /conf/env
replacing `CONTAINER_ID` with the container's ID or name.
The contents of the `/conf/env` file are standard shell
NAME=VALUE
entries where `NAME` is one of the variables described below.
Configuration options not explicitly supported below can be specified via the `OPTS` environment variable. For example, by default `OPTS` is set with
OPTS=-Dnetwork.bind_host=_non_loopback_
_NOTE: That option is a default since `bind_host` defaults to `localhost` as of 2.0, which isn't helpful for
port mapping out from the container_.
## Cluster Name
If joining a pre-existing cluster, then you may need to specify a cluster name different than the default "elasticsearch":
-e CLUSTER=dockers
## Zen Unicast Hosts
When joining a multi-physical-host cluster, multicast may not be supported on the physical network. In that case, your node can reference specific one or more hosts in the cluster via the [Zen Unicast Hosts](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-discovery-zen.html#unicast) capability as a comma-separated list of `HOST:PORT` pairs:
-e UNICAST_HOSTS=HOST:PORT[,HOST:PORT]
such as
-e UNICAST_HOSTS=192.168.0.100:9300
## Plugins
You can install one or more plugins before startup by passing a comma-separated list of plugins.
-e PLUGINS=ID[,ID]
In this example, it will install the Marvel plugin
-e PLUGINS=elasticsearch/marvel/latest
Many more plugins [are available here](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-plugins.html#known-plugins).
## Publish As
Since the container gives the Elasticsearch software an isolated perspective of its networking, it will most likely advertise its published address with a container-internal IP address. This can be overridden with a physical networking name and port using:
-e PUBLISH_AS=DOCKERHOST:9301
_Author Note: I have yet to hit a case where this was actually necessary. Other
than the cosmetic weirdness in the logs, Elasticsearch seems to be quite tolerant._
## Node Name
Rather than use the randomly assigned node name, you can indicate a specific one using:
-e NODE_NAME=Docker
## Node Type
If you refer to [the Node section](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/modules-node.html)
of the Elasticsearch reference guide, you'll find that there's three main types of nodes: master-eligible, data, and client.
In larger clusters it is important to dedicate a small number (>= 3) of master nodes. There are also cases where a large cluster may need dedicated gateway nodes that are neither master nor data nodes and purely operate as "smart routers" and have large amounts of CPU and memory to handle client requests and search-reduce.
To simplify all that, this image provides a `TYPE` variable to let you amongst these combinations. The choices are:
* (not set, the default) : the default node type which is both master-eligible and a data node
*`MASTER` : master-eligible, but holds no data. It is good to have three or more of these in a
large cluster
*`DATA` (or `NON_MASTER`) : holds data and serves search/index requests. Scale these out for elastic-y goodness.
*`GATEWAY` (or `COORDINATING`) : only operates as a client node or a "smart router". These are the ones whose HTTP port 9200 will need to be exposed
*`INGEST` : operates only as an ingest node and is not master or data eligble
A [Docker Compose](https://docs.docker.com/compose/overview/) file will serve as a good example of these three node types:
```
version: '2'
services:
gateway:
image: itzg/elasticsearch
environment:
UNICAST_HOSTS: master
TYPE: GATEWAY
ports:
- "9200:9200"
master:
image: itzg/elasticsearch
environment:
UNICAST_HOSTS: gateway
TYPE: MASTER
MIN_MASTERS: 2
data:
image: itzg/elasticsearch
environment:
UNICAST_HOSTS: master,gateway
TYPE: DATA
```
## Minimum Master Nodes
In combination with the `TYPE` variable above, you will also want to configure the minimum master nodes to [avoid split-brain](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/modules-node.html#split-brain) during network outages.
The minimum, which can be calculated as `(master_eligible_nodes / 2) + 1`, can be set with the `MIN_MASTERS` variable.
Using the Docker Compose file above, a value of `2` is appropriate when scaling the cluster to 3 master nodes:
docker-compose scale master=3
## Multiple Network Binding, such as Swarm Mode
When using Docker Swarm mode the container is presented with multiple ethernet
devices. By default, all global, routable IP addresses are configured for
Elasticsearch to use as `network.host`.
That discovery can be overridden by providing a specific ethernet device name
to `DISCOVER_TRANSPORT_IP` and/or `DISCOVER_HTTP_IP`, such as
-e DISCOVER_TRANSPORT_IP=eth0
-e DISCOVER_HTTP_IP=eth2
## Heap size and other JVM options
By default this image will run Elasticsearch with a Java heap size of 1 GB. If that value
or any other JVM options need to be adjusted, then replace the `ES_JAVA_OPTS`
environment variable.
For example, this would allow for the use of 16 GB of heap:
-e ES_JAVA_OPTS="-Xms16g -Xmx16g"
Refer to [this page](https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html)
for more information about why both the minimum and maximum sizes were set to
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.